Skip to content

Commit

Permalink
add base chain
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Jul 18, 2023
1 parent fbf66fa commit a3bae70
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
36 changes: 12 additions & 24 deletions src/ChainApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ test("ChainApi - sumTokens - use tokensAndOwners", async () => {
expect(res['ethereum:0x419B8ED155180A8c9C64145e76DaD49c0A4Efb97'.toLowerCase()]).toEqual('3284260000000000000000')
expect(res['ethereum:' + nullAddress]).toEqual('3371095284832904')
})
test("ChainApi - sumTokens - use ownerTokens", async () => {
const api = new ChainApi({})
const res = await api.sumTokens({
ownerTokens: [
[['0x419B8ED155180A8c9C64145e76DaD49c0A4Efb97', nullAddress], '0x9a849A108764a5cE2Ab4CD3208071B304a9Ac99A',],
]
})
expect(res['ethereum:0x419B8ED155180A8c9C64145e76DaD49c0A4Efb97'.toLowerCase()]).toEqual('3284260000000000000000')
expect(res['ethereum:' + nullAddress]).toEqual('3371095284832904')
})

test("ChainApi - sumTokens - use tokensAndOwners2", async () => {
const api = new ChainApi({})
Expand Down Expand Up @@ -272,30 +282,8 @@ test("ChainApi - sumTokens - era", async () => {
})
})

test("ChainApi - sumTokens - mantle", async () => {
const api = new ChainApi({ chain: 'mantle' })
const polkaMultisig = '0x3BfC20f0B9aFcAcE800D73D2191166FF16540258'
const blacklistedToken = '0xfe633a37c77241b825f1cf39afff44cb56242b77'
const blacklistedToken2Owner = '0xc5Fba8936315A57217222593f0A6Bb0Bdcc2985B'
const res = await api.sumTokens({
tokensAndOwners2: [
[nullAddress, nullAddress],
[polkaMultisig, polkaMultisig, polkaMultisig],
],
tokensAndOwners: [
[nullAddress, polkaMultisig],
[nullAddress, polkaMultisig],
],
blacklistedTokens: [blacklistedToken],
blacklistedOwners: [blacklistedToken2Owner],
tokens: [nullAddress],
owners: [polkaMultisig, blacklistedToken2Owner],
})
expect(res).toEqual({})
})

test("ChainApi - sumTokens - neon_evm", async () => {
const api = new ChainApi({ chain: 'neon_evm' })
test("ChainApi - sumTokens - base", async () => {
const api = new ChainApi({ chain: 'base' })
const polkaMultisig = '0x3BfC20f0B9aFcAcE800D73D2191166FF16540258'
const blacklistedToken = '0xfe633a37c77241b825f1cf39afff44cb56242b77'
const blacklistedToken2Owner = '0xc5Fba8936315A57217222593f0A6Bb0Bdcc2985B'
Expand Down
5 changes: 5 additions & 0 deletions src/ChainApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,13 @@ export class ChainApi {
tokensAndOwners2 = [],
blacklistedTokens = [],
blacklistedOwners = [],
ownerTokens = [],
}: {
tokens?: string[],
owners?: string[],
tokensAndOwners?: string[][],
tokensAndOwners2?: string[][],
ownerTokens?: any[],
blacklistedTokens?: string[],
blacklistedOwners?: string[],
}): Promise<Balances> {
Expand All @@ -138,6 +140,9 @@ export class ChainApi {

if (tokens.length && owners.length)
tokensAndOwners.push(...tokens.map(i => owners.map(j => [i, j])).flat())

for (const [tokens, owner] of ownerTokens)
tokens.forEach((i: any) => tokensAndOwners.push([i, owner]))

tokensAndOwners = getUniqueTokensAndOwners(tokensAndOwners, this.chain as string)
blacklistedOwners = getUniqueAddresses(blacklistedOwners)
Expand Down
1 change: 1 addition & 0 deletions src/abi/multicall3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const DEPLOYMENT_BLOCK = {
era: 3908235,
mantle: 3962,
neon_evm: 205939275,
base: 5022,
} as {
[key: string | Chain]: number
}
Expand Down
6 changes: 6 additions & 0 deletions src/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -800,5 +800,11 @@
"https://neon-proxy-mainnet.solana.p2p.org"
],
"chainId": 245022934
},
"base": {
"rpc": [
"https://developer-access-mainnet.base.org/"
],
"chainId": 8453
}
}

0 comments on commit a3bae70

Please sign in to comment.