Skip to content

Commit

Permalink
ALL-9443 Renamed Currency.ARB BASE OPTIMISM & Added USDC USDT for ARB…
Browse files Browse the repository at this point in the history
… BASE OPTIMISM (#1136)

* ALL-9443 Rename Currency.BASE OPTIMISM & Added USDC USDT for ARB BASE OPTIMISM V2

* ALL-9443 add missing .toString-s.
  • Loading branch information
LevanOzashvili-Tatum authored Nov 18, 2024
1 parent 3515554 commit cbe96ea
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 31 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tatumio",
"version": "2.2.87",
"version": "2.2.88",
"license": "MIT",
"repository": "https://github.com/tatumio/tatum-js",
"scripts": {
Expand Down Expand Up @@ -133,4 +133,4 @@
"@solana/web3.js": "1.56.2",
"scrypt": "github:barrysteyn/node-scrypt#fb60a8d3c158fe115a624b5ffa7480f3a24b03fb"
}
}
}
21 changes: 18 additions & 3 deletions packages/api-client/src/lib/models/Currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export enum Currency {
NEO = 'NEO',
KLAY = 'KLAY',
EOS = 'EOS',
ARB = 'ARB',
OPTIMISM = 'OPTIMISM',
ETH_ARB = 'ETH_ARB',
ETH_OP = 'ETH_OP',
NEAR = 'NEAR',
CRO = 'CRO',
RSK = 'RSK',
Expand All @@ -99,7 +99,7 @@ export enum Currency {
CHZ = 'CHZ',
ISLM = 'ISLM',
FLR = 'FLR',
BASE = 'BASE',
ETH_BASE = 'ETH_BASE',
KADENA = 'KADENA',
ROSTRUM = 'ROSTRUM',
ATOM = 'ATOM',
Expand All @@ -108,6 +108,12 @@ export enum Currency {
'CSPR' = 'CSPR',
TON = 'TON',
ZK_SYNC = 'ZK_SYNC',
USDC_ARB = 'USDC_ARB',
USDC_OP = 'USDC_OP',
USDC_BASE = 'USDC_BASE',
USDT_ARB = 'USDT_ARB',
USDT_OP = 'USDT_OP',
USDT_BASE = 'USDT_BASE',
}

export const ERC20_CURRENCIES = [
Expand Down Expand Up @@ -201,6 +207,15 @@ export const MATIC_BASED_CURRENCIES = [Currency.MATIC, ...MATIC20_CURRENCIES]

export const BSC_BASED_CURRENCIES = [Currency.BSC, ...BEP20_CURRENCIES]

export const ARB_CURRENCIES = [Currency.USDC_ARB, Currency.USDT_ARB]
export const ARB_BASED_CURRENCIES = [Currency.ETH_ARB, ...ARB_CURRENCIES]

export const OPTIMISM_CURRENCIES = [Currency.USDC_OP, Currency.USDT_OP]
export const OPTIMISM_BASED_CURRENCIES = [Currency.ETH_OP, ...OPTIMISM_CURRENCIES]

export const BASE_CURRENCIES = [Currency.USDC_BASE, Currency.USDT_BASE]
export const BASE_BASED_CURRENCIES = [Currency.ETH_BASE, ...BASE_CURRENCIES]

export const NFT_SUPPORTED_CURRENCIES = [
Currency.ETH,
Currency.MATIC,
Expand Down
24 changes: 12 additions & 12 deletions packages/blockchain/base/src/lib/__tests__/base.nft.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe.skip('BaseSDK - nft', () => {
deployNFTSmartContract: [
api.nftDeployErc721,
{
chain: Currency.BASE,
chain: 'BASE',
name: 'erc721-token',
symbol: 'erc721-token',
fromPrivateKey: testData.TESTNET.ERC_721.PRIVATE_KEY,
Expand All @@ -38,15 +38,15 @@ describe.skip('BaseSDK - nft', () => {
mintNFT: [
api.nftMintErc721,
{
chain: Currency.BASE,
chain: 'BASE',
to: testData.TESTNET.ERC_721?.ADDRESS,
url: 'https://google.com/',
},
],
transferNFT: [
api.nftTransferErc721,
{
chain: Currency.BASE,
chain: 'BASE',
to: testData.TESTNET.ERC_721?.ADDRESS,
contractAddress: testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
tokenId: 'erc721-token',
Expand All @@ -56,7 +56,7 @@ describe.skip('BaseSDK - nft', () => {
mintMultipleNFTs: [
api.nftMintMultipleErc721,
{
chain: Currency.BASE,
chain: 'BASE',
to: testData.TESTNET.ERC_721?.ADDRESS,
tokenId: 'erc721-token',
minter: testData.TESTNET.ERC_721?.ADDRESS,
Expand All @@ -67,7 +67,7 @@ describe.skip('BaseSDK - nft', () => {
burnNFT: [
api.nftBurnErc721,
{
chain: Currency.BASE,
chain: 'BASE',
tokenId: 'erc721-token',
contractAddress: testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
fromPrivateKey: testData.TESTNET.ERC_721?.PRIVATE_KEY,
Expand All @@ -76,45 +76,45 @@ describe.skip('BaseSDK - nft', () => {
addNFTMinter: [
api.nftAddMinter,
{
chain: Currency.BASE,
chain: 'BASE',
contractAddress: testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
minter: testData.TESTNET.ERC_721?.ADDRESS,
fromPrivateKey: testData.TESTNET.ERC_721?.PRIVATE_KEY,
},
],
getNFTTransaction: [
api.nftGetTransactErc721,
Currency.BASE,
'BASE',
'0xe6e7340394958674cdf8606936d292f565e4ecc476aaa8b258ec8a141f7c75d7',
],
getNFTTransactionsByToken: [
api.nftGetTransactionByToken,
Currency.BASE,
'BASE',
'erc721-token',
testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
20,
],
getNFTTransactionsByAddress: [
api.nftGetTransactionByAddress,
Currency.BASE,
'BASE',
testData.TESTNET.ERC_721?.ADDRESS,
testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
20,
],
getNFTsByAddress: [
api.nftGetTokensByAddressErc721,
Currency.BASE,
'BASE',
testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
],
getNFTAccountBalance: [
api.nftGetBalanceErc721,
Currency.BASE,
'BASE',
testData.TESTNET.ERC_721?.ADDRESS,
testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
],
getNFTMetadataURI: [
api.nftGetMetadataErc721,
Currency.BASE,
'BASE',
testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
'erc721-token',
],
Expand Down
24 changes: 12 additions & 12 deletions packages/blockchain/optimism/src/lib/__tests__/optimism.nft.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('OptimismSDK - nft', () => {
deployNFTSmartContract: [
api.nftDeployErc721,
{
chain: Currency.OPTIMISM,
chain: 'OPTIMISM',
name: 'erc721-token',
symbol: 'erc721-token',
fromPrivateKey: testData.TESTNET.ERC_721.PRIVATE_KEY,
Expand All @@ -38,15 +38,15 @@ describe('OptimismSDK - nft', () => {
mintNFT: [
api.nftMintErc721,
{
chain: Currency.OPTIMISM,
chain: 'OPTIMISM',
to: testData.TESTNET.ERC_721?.ADDRESS,
url: 'https://google.com/',
},
],
transferNFT: [
api.nftTransferErc721,
{
chain: Currency.OPTIMISM,
chain: 'OPTIMISM',
to: testData.TESTNET.ERC_721?.ADDRESS,
contractAddress: testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
tokenId: 'erc721-token',
Expand All @@ -56,7 +56,7 @@ describe('OptimismSDK - nft', () => {
mintMultipleNFTs: [
api.nftMintMultipleErc721,
{
chain: Currency.OPTIMISM,
chain: 'OPTIMISM',
to: testData.TESTNET.ERC_721?.ADDRESS,
tokenId: 'erc721-token',
minter: testData.TESTNET.ERC_721?.ADDRESS,
Expand All @@ -67,7 +67,7 @@ describe('OptimismSDK - nft', () => {
burnNFT: [
api.nftBurnErc721,
{
chain: Currency.OPTIMISM,
chain: 'OPTIMISM',
tokenId: 'erc721-token',
contractAddress: testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
fromPrivateKey: testData.TESTNET.ERC_721?.PRIVATE_KEY,
Expand All @@ -76,45 +76,45 @@ describe('OptimismSDK - nft', () => {
addNFTMinter: [
api.nftAddMinter,
{
chain: Currency.OPTIMISM,
chain: 'OPTIMISM',
contractAddress: testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
minter: testData.TESTNET.ERC_721?.ADDRESS,
fromPrivateKey: testData.TESTNET.ERC_721?.PRIVATE_KEY,
},
],
getNFTTransaction: [
api.nftGetTransactErc721,
Currency.OPTIMISM,
'OPTIMISM',
'0xe6e7340394958674cdf8606936d292f565e4ecc476aaa8b258ec8a141f7c75d7',
],
getNFTTransactionsByToken: [
api.nftGetTransactionByToken,
Currency.OPTIMISM,
'OPTIMISM',
'erc721-token',
testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
20,
],
getNFTTransactionsByAddress: [
api.nftGetTransactionByAddress,
Currency.OPTIMISM,
'OPTIMISM',
testData.TESTNET.ERC_721?.ADDRESS,
testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
20,
],
getNFTsByAddress: [
api.nftGetTokensByAddressErc721,
Currency.OPTIMISM,
'OPTIMISM',
testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
],
getNFTAccountBalance: [
api.nftGetBalanceErc721,
Currency.OPTIMISM,
'OPTIMISM',
testData.TESTNET.ERC_721?.ADDRESS,
testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
],
getNFTMetadataURI: [
api.nftGetMetadataErc721,
Currency.OPTIMISM,
'OPTIMISM',
testData.TESTNET.ERC_721?.CONTRACT_ADDRESS,
'erc721-token',
],
Expand Down
12 changes: 12 additions & 0 deletions packages/shared/core/src/lib/contract.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ export const CONTRACT_ADDRESSES = {
[Currency.CAKE.toString()]: '0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82',
[Currency.BUSD_BSC.toString()]: '0xe9e7cea3dedca5984780bafc599bd69add087d56',
[Currency.GMC_BSC.toString()]: '0xa6272359bc37f61af398071b65c8934aca744d53',
[Currency.USDC_ARB.toString()]: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
[Currency.USDT_ARB.toString()]: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9',
[Currency.USDC_OP.toString()]: '0x0b2c639c533813f4aa9d7837caf62653d097ff85',
[Currency.USDT_OP.toString()]: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58',
[Currency.USDC_BASE.toString()]: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
[Currency.USDT_BASE.toString()]: '0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2',
}

export const CONTRACT_DECIMALS = {
Expand Down Expand Up @@ -90,6 +96,12 @@ export const CONTRACT_DECIMALS = {
[Currency.BXRP.toString()]: 18,
[Currency.BLTC.toString()]: 18,
[Currency.BBCH.toString()]: 18,
[Currency.USDC_ARB.toString()]: 6,
[Currency.USDT_ARB.toString()]: 6,
[Currency.USDC_OP.toString()]: 6,
[Currency.USDT_OP.toString()]: 6,
[Currency.USDC_BASE.toString()]: 6,
[Currency.USDT_BASE.toString()]: 6,
}

export const CUSTODIAL_PROXY_ABI = {
Expand Down
12 changes: 10 additions & 2 deletions packages/shared/core/src/lib/models/BlockchainCurrencyMapping.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import {
BASE_BASED_CURRENCIES,
BSC_BASED_CURRENCIES,
CELO_CURRENCIES,
Currency,
ETH_BASED_CURRENCIES,
FLOW_CURRENCIES,
MATIC_BASED_CURRENCIES,
NativeCurrency,
OPTIMISM_BASED_CURRENCIES,
TRON_CURRENCIES,
} from '@tatumio/api-client'
import { Blockchain } from './Blockchain'
Expand Down Expand Up @@ -60,9 +62,15 @@ export const BlockchainCurrencyMapping: Record<
CHILIZ: Currency.CHZ,
FLR: Currency.FLR,
CRO: Currency.CRO,
BASE: Currency.BASE,
BASE: {
nativeCurrency: Currency.ETH_BASE,
currencies: BASE_BASED_CURRENCIES,
},
AVAX: Currency.AVAX,
OPTIMISM: Currency.OPTIMISM,
OPTIMISM: {
nativeCurrency: Currency.ETH_OP,
currencies: OPTIMISM_BASED_CURRENCIES
},
FTM: Currency.FTM,
TON: Currency.TON,
ZK_SYNC: Currency.ZK_SYNC,
Expand Down

0 comments on commit cbe96ea

Please sign in to comment.