Skip to content

Commit d0014c2

Browse files
committed
Merge branch 'arc-network-first-pass' of github.com:tmcollins4/bitcore
2 parents 3491bf1 + 0d2861e commit d0014c2

13 files changed

Lines changed: 148 additions & 4 deletions

File tree

bitcore-test.config.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,22 @@
103103
"threads": 0
104104
}
105105
},
106+
"ARC": {
107+
"testnet": {
108+
"chainSource": "external",
109+
"module": "./moralis",
110+
"trustedPeers": [],
111+
"providers": [
112+
{
113+
"host": "rpc.testnet.arc.network",
114+
"protocol": "https",
115+
"port": "",
116+
"dataType": "combined"
117+
}
118+
],
119+
"threads": 0
120+
}
121+
},
106122
"BASE": {
107123
"sepolia": {
108124
"chainSource": "external",

packages/bitcore-client/src/wallet.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const chainLibs = {
3737
ARB: { Web3, ethers },
3838
BASE: { Web3, ethers },
3939
OP: { Web3, ethers },
40+
ARC: { Web3, ethers },
4041
XRP: xrpl,
4142
SOL: { SolKit, SolanaProgram }
4243
};
@@ -303,7 +304,7 @@ export class Wallet {
303304
* @returns {Boolean}
304305
*/
305306
isEvmChain() {
306-
return ['ETH', 'MATIC', 'ARB', 'OP', 'BASE'].includes(this.chain?.toUpperCase());
307+
return ['ETH', 'MATIC', 'ARB', 'OP', 'BASE', 'ARC'].includes(this.chain?.toUpperCase());
307308
}
308309

309310
isSolanaChain() {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { expect } from 'chai';
2+
import { Wallet } from '../../src/wallet';
3+
4+
describe('Wallet ARC support', function() {
5+
it('should treat ARC as an EVM chain', function() {
6+
const arcWallet = Object.assign(Object.create(Wallet.prototype), { chain: 'ARC' }) as Wallet;
7+
expect(arcWallet.isEvmChain()).to.equal(true);
8+
expect(arcWallet.getLib()).to.have.keys(['Web3', 'ethers']);
9+
});
10+
});

packages/crypto-wallet-core/src/constants/chains.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
export const UTXO_CHAINS = ['btc', 'bch', 'doge', 'ltc'];
3-
export const EVM_CHAINS = ['eth', 'matic', 'arb', 'base', 'op'];
3+
export const EVM_CHAINS = ['eth', 'matic', 'arb', 'base', 'op', 'arc'];
44
export const SVM_CHAINS = ['sol'];
55
export const RIPPLE_CHAINS = ['xrp'];
66
export const CHAINS = [...UTXO_CHAINS, ...EVM_CHAINS, ...SVM_CHAINS, ...RIPPLE_CHAINS];
@@ -12,7 +12,8 @@ export const EVM_CHAIN_DEFAULT_TESTNET = {
1212
MATIC: 'amoy',
1313
ARB: 'sepolia',
1414
BASE: 'sepolia',
15-
OP: 'sepolia'
15+
OP: 'sepolia',
16+
ARC: 'testnet'
1617
};
1718

1819
export const EVM_CHAIN_NETWORK_TO_CHAIN_ID = {
@@ -22,6 +23,7 @@ export const EVM_CHAIN_NETWORK_TO_CHAIN_ID = {
2223
ARB_mainnet: 42161,
2324
BASE_mainnet: 8453,
2425
OP_mainnet: 10,
26+
ARC_mainnet: 'unsupported',
2527
// ETH testnets
2628
ETH_holesky: 17000,
2729
ETH_sepolia: 11155111,
@@ -41,6 +43,8 @@ export const EVM_CHAIN_NETWORK_TO_CHAIN_ID = {
4143
// OP testnets
4244
OP_sepolia: 11155420,
4345
OP_goerli: 28528,
46+
// ARC testnets
47+
ARC_testnet: 5042002,
4448
// Regtests
4549
ETH_regtest: 1337,
4650
MATIC_regtest: 13375,

packages/crypto-wallet-core/src/constants/units.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ export const UNITS = {
8787
minDecimals: 2
8888
}
8989
},
90+
arc: {
91+
toSatoshis: 1e18,
92+
full: {
93+
maxDecimals: 6,
94+
minDecimals: 6
95+
},
96+
short: {
97+
maxDecimals: 6,
98+
minDecimals: 2
99+
}
100+
},
90101
xrp: {
91102
toSatoshis: 1e6,
92103
full: {

packages/crypto-wallet-core/src/derivation/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const derivers: { [chain: string]: IDeriver } = {
2323
ARB: new ArbDeriver(),
2424
BASE: new BaseDeriver(),
2525
OP: new OpDeriver(),
26+
ARC: new EthDeriver(),
2627
SOL: new SolDeriver()
2728
};
2829

packages/crypto-wallet-core/src/derivation/paths.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export const Paths = {
3333
BASE: {
3434
default: "m/44'/60'/",
3535
},
36+
ARC: {
37+
default: "m/44'/60'/",
38+
},
3639
SOL: {
3740
default: "m/44'/501'/",
3841
},

packages/crypto-wallet-core/src/transactions/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const providers = {
4141
BASEERC20: new BASEERC20TxProvider(),
4242
OP: new OPTxProvider(),
4343
OPERC20: new OPERC20TxProvider(),
44+
ARC: new ETHTxProvider('ARC'),
45+
ARCERC20: new ERC20TxProvider('ARC'),
4446
SOL: new SOLTxProvider(),
4547
SOLSPL: new SPLTxProvider(),
4648
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { EthValidation } from '../eth';
2+
3+
export class ArcValidation extends EthValidation {
4+
constructor() {
5+
super();
6+
this.regex = /arc/i;
7+
}
8+
}

packages/crypto-wallet-core/src/validation/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ArbValidation } from './arb';
2+
import { ArcValidation } from './arc';
23
import { BaseValidation } from './base';
34
import { BchValidation } from './bch';
45
import { BtcValidation } from './btc';
@@ -22,6 +23,7 @@ const validation: { [chain: string]: IValidation } = {
2223
ARB: new ArbValidation(),
2324
BASE: new BaseValidation(),
2425
OP: new OpValidation(),
26+
ARC: new ArcValidation(),
2527
SOL: new SolValidation(),
2628
};
2729

0 commit comments

Comments
 (0)