diff --git a/package.json b/package.json index 7feb51b..e26feb1 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "typescript": "^4.6.3" }, "dependencies": { - "@ainblockchain/ain-js": "^1.9.0", + "@ainblockchain/ain-js": "^1.10.0", "axios": "^0.26.1", "express": "^4.18.2", "fast-json-stable-stringify": "^2.1.0", diff --git a/src/ain.ts b/src/ain.ts index 8b6c3fc..7b1ef2a 100644 --- a/src/ain.ts +++ b/src/ain.ts @@ -1,5 +1,5 @@ import Ain from "@ainblockchain/ain-js"; -import { getBlockChainEndpoint } from "./constants"; +import { getBlockChainAPIEndpoint, getBlockChainEventEndpoint } from "./constants"; import { TransactionBody } from "@ainblockchain/ain-util"; import { txResult } from "./types/type"; import { Signer } from "@ainblockchain/ain-js/lib/signer/signer"; @@ -18,8 +18,9 @@ export default class AinModule { } initAin(chainId: 0 | 1) { - const blockchainEndpoint = getBlockChainEndpoint(chainId); - this.ain = new Ain(blockchainEndpoint, chainId); + const blockchainAPIEndpoint = getBlockChainAPIEndpoint(chainId); + const blockchainEventEndpoint = getBlockChainEventEndpoint(chainId); + this.ain = new Ain(blockchainAPIEndpoint,blockchainEventEndpoint, chainId); } createAccount() { diff --git a/src/constants.ts b/src/constants.ts index cecbed1..3297640 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,9 +1,13 @@ import { appBillingConfig } from "./types/type" -export const getBlockChainEndpoint = (chainId: number) =>{ +export const getBlockChainAPIEndpoint = (chainId: number) =>{ + return chainId === 1 ? "https://mainnet-api.ainetwork.ai" : "https://testnet-api.ainetwork.ai" +} +export const getBlockChainEventEndpoint = (chainId: number) =>{ return chainId === 1 ? "https://mainnet-event.ainetwork.ai" : "https://testnet-event.ainetwork.ai" } + export const Path = { app: (appName: string): any => { return { diff --git a/yarn.lock b/yarn.lock index 20ddc49..b39b1ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@ainblockchain/ain-js@^1.9.0": - version "1.9.0" - resolved "https://registry.yarnpkg.com/@ainblockchain/ain-js/-/ain-js-1.9.0.tgz#3d04271149f5788bfd1913b604bc6c391327c10b" - integrity sha512-+JVumqje2h0zMIfnqO8kJMq8V3kAzk/ML67nP92qCww7cYvhl3MjX/mUWDUoEb9x5bEHPEulu7VVJvsn8aLrMA== +"@ainblockchain/ain-js@^1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@ainblockchain/ain-js/-/ain-js-1.10.0.tgz#2ab91ee9c5f083ef8830e8db528b69c18264aefa" + integrity sha512-4fmL7vaLBesY2de3aTtJTpjT0MO5ezeQSUlZcU5bjm5aY9LCFfCxSy3vkYrAROC7KstNODSfWjzMlpoc9afrWA== dependencies: "@ainblockchain/ain-util" "^1.1.9" "@types/node" "^12.7.3"