Skip to content

Commit

Permalink
Add Rootstock testnet and mainnet network support
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushalrajbacancy committed Apr 3, 2024
1 parent b51581c commit 86dbbc0
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog
## [1.6.5] - 2024-04-03
### New
- Added Rootstock testnet and mainnet network support

## [1.6.4] - 2024-03-20
### New
- Added `getTransactions` endpoint into DataUtils
Expand Down
4 changes: 2 additions & 2 deletions examples/13-paymaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dotenv.config();

const recipient = '0x80a1874E1046B1cc5deFdf4D3153838B72fF94Ac'; // recipient wallet address
const value = '0.01'; // transfer value
const api_key = 'arka_public_key'; // Only testnets are available, if you need further assistance in setting up a paymaster service for your dapp, please reach out to us on discord or https://etherspot.fyi/arka/intro
const apiKey = 'arka_public_key'; // Only testnets are available, if you need further assistance in setting up a paymaster service for your dapp, please reach out to us on discord or https://etherspot.fyi/arka/intro
const bundlerApiKey = 'eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6IjMxMDZiOGY2NTRhZTRhZTM4MGVjYjJiN2Q2NDMzMjM4IiwiaCI6Im11cm11cjEyOCJ9';

async function main() {
Expand Down Expand Up @@ -38,7 +38,7 @@ async function main() {

// estimate transactions added to the batch and get the fee data for the UserOp
const op = await primeSdk.estimate({
paymasterDetails: { url: `https://arka.etherspot.io?apiKey=${api_key}&chainId=${Number(process.env.CHAIN_ID)}`, context: { mode: 'sponsor' } }
paymasterDetails: { url: `https://arka.etherspot.io?apiKey=${apiKey}&chainId=${Number(process.env.CHAIN_ID)}`, context: { mode: 'sponsor' } }
});
console.log(`Estimate UserOp: ${await printOp(op)}`);

Expand Down
10 changes: 5 additions & 5 deletions examples/16-paymaster-arka.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const recipient = '0x80a1874E1046B1cc5deFdf4D3153838B72fF94Ac'; // recipient wal
const value = '0.0001'; // transfer value
const bundlerApiKey = 'eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6IjMxMDZiOGY2NTRhZTRhZTM4MGVjYjJiN2Q2NDMzMjM4IiwiaCI6Im11cm11cjEyOCJ9';

const arka_api_key = 'arka_public_key';
const arka_url = 'https://arka.etherspot.io'; // Only testnets are available, if you need further assistance in setting up a paymaster service for your dapp, please reach out to us on discord or https://etherspot.fyi/arka/intro
const queryString = `?apiKey=${arka_api_key}&chainId=${Number(process.env.CHAIN_ID)}`;
const arkaApiKey = 'arka_public_key';
const arkaUrl = 'https://arka.etherspot.io'; // Only testnets are available, if you need further assistance in setting up a paymaster service for your dapp, please reach out to us on discord or https://etherspot.fyi/arka/intro
const queryString = `?apiKey=${arkaApiKey}&chainId=${Number(process.env.CHAIN_ID)}`;

async function main() {
// initializing sdk...
Expand All @@ -40,7 +40,7 @@ async function main() {
* The fetching of pimlico erc20 paymaster address is only required for the first time for each specified gas token since we need to approve the tokens to spend
* from the paymaster address on behalf of you.
*/
const returnedValue = await fetch(`${arka_url}/pimlicoAddress${queryString}`, {
const returnedValue = await fetch(`${arkaUrl}/pimlicoAddress${queryString}`, {
method: 'POST',
headers: {
'Accept': 'application/json',
Expand Down Expand Up @@ -90,7 +90,7 @@ async function main() {

// estimate transactions added to the batch and get the fee data for the UserOp
const op = await primeSdk.estimate({
paymasterDetails: { url: `${arka_url}${queryString}`, context: { token: "USDC", mode: 'erc20' } }
paymasterDetails: { url: `${arkaUrl}${queryString}`, context: { token: "USDC", mode: 'erc20' } }
});
console.log(`Estimate UserOp: ${await printOp(op)}`);

Expand Down
8 changes: 4 additions & 4 deletions examples/19-paymaster-validUntil-validAfter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const recipient = '0x80a1874E1046B1cc5deFdf4D3153838B72fF94Ac'; // recipient wal
const value = '0.0001'; // transfer value
const bundlerApiKey = 'eyJvcmciOiI2NTIzZjY5MzUwOTBmNzAwMDFiYjJkZWIiLCJpZCI6IjMxMDZiOGY2NTRhZTRhZTM4MGVjYjJiN2Q2NDMzMjM4IiwiaCI6Im11cm11cjEyOCJ9';

const arka_api_key = 'arka_public_key'; // Only testnets are available, if you need further assistance in setting up a paymaster service for your dapp, please reach out to us on discord or https://etherspot.fyi/arka/intro
const arka_url = 'https://arka.etherspot.io';
const queryString = `?apiKey=${arka_api_key}&chainId=${Number(process.env.CHAIN_ID)}`;
const arkaApiKey = 'arka_public_key'; // Only testnets are available, if you need further assistance in setting up a paymaster service for your dapp, please reach out to us on discord or https://etherspot.fyi/arka/intro
const arkaUrl = 'https://arka.etherspot.io';
const queryString = `?apiKey=${arkaApiKey}&chainId=${Number(process.env.CHAIN_ID)}`;

async function main() {
// initializing sdk...
Expand Down Expand Up @@ -48,7 +48,7 @@ async function main() {
validUntil and validAfter is relevant only with sponsor transactions and not for token paymasters
*/
const op = await primeSdk.estimate({
paymasterDetails: { url: `${arka_url}${queryString}`, context: { mode: 'sponsor', validAfter: new Date().valueOf(), validUntil: new Date().valueOf() + 6000000 } }
paymasterDetails: { url: `${arkaUrl}${queryString}`, context: { mode: 'sponsor', validAfter: new Date().valueOf(), validUntil: new Date().valueOf() + 6000000 } }
});
console.log(`Estimate UserOp: ${await printOp(op)}`);

Expand Down
6 changes: 3 additions & 3 deletions examples/24-ArkaPaymaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import * as dotenv from 'dotenv';
dotenv.config();

async function main() {
const arka_api_key = 'arka_public_key';
const arka_url = 'https://arka.etherspot.io'; // Only testnets are available, if you need further assistance in setting up a paymaster service for your dapp, please reach out to us on discord or https://etherspot.fyi/arka/intro
const arkaApiKey = 'arka_public_key';
const arkaUrl = 'https://arka.etherspot.io'; // Only testnets are available, if you need further assistance in setting up a paymaster service for your dapp, please reach out to us on discord or https://etherspot.fyi/arka/intro

// initializating sdk...
const arkaPaymaster = new ArkaPaymaster(Number(process.env.CHAIN_ID), arka_api_key, arka_url);
const arkaPaymaster = new ArkaPaymaster(Number(process.env.CHAIN_ID), arkaApiKey, arkaUrl);

console.log(await arkaPaymaster.metadata());
console.log(await arkaPaymaster.getTokenPaymasterAddress("eUSDC"))
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@etherspot/prime-sdk",
"version": "1.6.4",
"version": "1.6.5",
"description": "Etherspot Prime (Account Abstraction) SDK",
"keywords": [
"ether",
Expand Down
24 changes: 19 additions & 5 deletions src/sdk/network/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export enum NetworkNames {
KromaTestnet = 'kromaTestnet',
Mainnet = 'mainnet',
OptimismGoerli = 'optimismGoerli',
RSKTestnet = 'RSKTestnet',
Rootstock = 'rootstock',
RootstockTestnet = 'rootstockTestnet',
VerseTestnet = 'verseTestnet',
Mantle = 'Mantle',
MantleTestnet = 'MantleTestnet',
Expand All @@ -37,7 +38,7 @@ export enum NetworkNames {
}

export const SupportedNetworks =
[1, 5, 10, 14, 31, 56, 97, 100, 114, 122, 123, 137, 420, 1001, 2357, 5000, 5001, 8217, 8453, 10200, 20197, 42161, 43113, 43114, 59140, 59144, 80001, 84531, 84532, 421613, 534351, 534352, 11155111]
[1, 5, 10, 14, 30, 31, 56, 97, 100, 114, 122, 123, 137, 420, 1001, 2357, 5000, 5001, 8217, 8453, 10200, 20197, 42161, 43113, 43114, 59140, 59144, 80001, 84531, 84532, 421613, 534351, 534352, 11155111]

export const NETWORK_NAME_TO_CHAIN_ID: {
[key: string]: number;
Expand All @@ -58,7 +59,8 @@ export const NETWORK_NAME_TO_CHAIN_ID: {
[NetworkNames.KromaTestnet]: 2357,
[NetworkNames.Mainnet]: 1,
[NetworkNames.OptimismGoerli]: 420,
[NetworkNames.RSKTestnet]: 31,
[NetworkNames.Rootstock]: 30,
[NetworkNames.RootstockTestnet]: 31,
[NetworkNames.VerseTestnet]: 20197,
[NetworkNames.Mantle]: 5000,
[NetworkNames.MantleTestnet]: 5001,
Expand Down Expand Up @@ -298,11 +300,23 @@ export const Networks: {
}
},
},
[30]: {
chainId: 30,
bundler: 'https://rpc.etherspot.io/rootstock',
contracts: {
entryPoint: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789',
walletFactory: {
etherspot: '0x7f6d8F107fE8551160BD5351d5F1514A6aD5d40E',
zeroDev: '',
simpleAccount: '0x9406Cc6185a346906296840746125a0E44976454',
}
},
},
[31]: {
chainId: 31,
bundler: '',
bundler: 'https://rootstocktestnet-bundler.etherspot.io/',
contracts: {
entryPoint: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789',
entryPoint: '0x48e60BBb664aEfAc9f14aDB42e5FB5b4a119EB66',
walletFactory: {
etherspot: '0x7f6d8F107fE8551160BD5351d5F1514A6aD5d40E',
zeroDev: '',
Expand Down

0 comments on commit 86dbbc0

Please sign in to comment.