@broxus/js-core
Advanced tools
Comparing version 0.13.2 to 0.13.3
@@ -165,4 +165,4 @@ "use strict"; | ||
*/ | ||
static getBalance(connection, dexAccountAddress, tokenAddress, cachedState) { | ||
return (0, contracts_1.dexAccountContract)(connection, dexAccountAddress) | ||
static async getBalance(connection, dexAccountAddress, tokenAddress, cachedState) { | ||
const result = await (0, contracts_1.dexAccountContract)(connection, dexAccountAddress) | ||
.methods.getWalletData({ | ||
@@ -172,4 +172,4 @@ answerId: 0, | ||
}) | ||
.call({ cachedState }) | ||
.then(result => result.balance); | ||
.call({ cachedState, responsible: true }); | ||
return result.balance; | ||
} | ||
@@ -214,7 +214,7 @@ /** | ||
*/ | ||
static getVersion(connection, dexAccountAddress, cachedState) { | ||
return (0, contracts_1.dexAccountContract)(connection, dexAccountAddress) | ||
static async getVersion(connection, dexAccountAddress, cachedState) { | ||
const result = await (0, contracts_1.dexAccountContract)(connection, dexAccountAddress) | ||
.methods.getVersion({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
@@ -229,4 +229,4 @@ /** | ||
*/ | ||
static getWallet(connection, dexAccountAddress, tokenAddress, cachedState) { | ||
return (0, contracts_1.dexAccountContract)(connection, dexAccountAddress) | ||
static async getWallet(connection, dexAccountAddress, tokenAddress, cachedState) { | ||
const result = await (0, contracts_1.dexAccountContract)(connection, dexAccountAddress) | ||
.methods.getWalletData({ | ||
@@ -236,4 +236,4 @@ answerId: 0, | ||
}) | ||
.call({ cachedState }) | ||
.then(result => result.wallet); | ||
.call({ cachedState, responsible: true }); | ||
return result.wallet; | ||
} | ||
@@ -240,0 +240,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DexPairUtils = exports.DexPairType = void 0; | ||
exports.DexPairUtils = void 0; | ||
const contracts_1 = require("../../models/dex-pair/contracts"); | ||
const tvm_token_1 = require("../../models/tvm-token"); | ||
const utils_1 = require("../../utils"); | ||
var DexPairType; | ||
(function (DexPairType) { | ||
DexPairType["CONSTANT_PRODUCT"] = "1"; | ||
DexPairType["STABLE_PAIR"] = "2"; | ||
DexPairType["STABLE_POOL"] = "3"; | ||
})(DexPairType || (exports.DexPairType = DexPairType = {})); | ||
class DexPairUtils { | ||
@@ -14,0 +8,0 @@ static async getDetails(connection, pairAddress, cachedState) { |
@@ -57,3 +57,3 @@ "use strict"; | ||
.methods.getBalances({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -67,3 +67,3 @@ lpSupply: result.value0.lp_supply, | ||
.methods.getVirtualPrice({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -94,3 +94,3 @@ } | ||
.methods.getFeeParams({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -107,3 +107,3 @@ beneficiaryAddress: result.value0.beneficiary, | ||
.methods.getRoot({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.dex_root; | ||
@@ -114,3 +114,3 @@ } | ||
.methods.getVault({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.dex_vault; | ||
@@ -121,3 +121,3 @@ } | ||
.methods.isActive({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -128,3 +128,3 @@ } | ||
.methods.getTokenRoots({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -227,3 +227,3 @@ lp: results.lp, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -247,3 +247,3 @@ amounts: result.value0.amounts, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -262,3 +262,3 @@ expectedFee: result.expected_fee, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -276,3 +276,3 @@ expectedAmount: result.expected_amount, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -289,3 +289,3 @@ expectedFee: result.expected_fee, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -309,3 +309,3 @@ amounts: result.value0.amounts, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -312,0 +312,0 @@ } |
@@ -85,4 +85,4 @@ "use strict"; | ||
*/ | ||
static getExpectedAccountAddress(connection, dexRootAddress, params, cachedState) { | ||
return (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
static async getExpectedAccountAddress(connection, dexRootAddress, params, cachedState) { | ||
const result = await (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
.methods.getExpectedAccountAddress({ | ||
@@ -92,4 +92,4 @@ account_owner: (0, utils_1.resolveTvmAddress)(params.ownerAddress), | ||
}) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
@@ -105,4 +105,4 @@ /** | ||
*/ | ||
static getExpectedPairAddress(connection, dexRootAddress, params, cachedState) { | ||
return (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
static async getExpectedPairAddress(connection, dexRootAddress, params, cachedState) { | ||
const result = await (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
.methods.getExpectedPairAddress({ | ||
@@ -113,4 +113,4 @@ answerId: 0, | ||
}) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
@@ -126,4 +126,4 @@ /** | ||
*/ | ||
static getExpectedPoolAddress(connection, dexRootAddress, params, cachedState) { | ||
return (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
static async getExpectedPoolAddress(connection, dexRootAddress, params, cachedState) { | ||
const result = await (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
.methods.getExpectedPoolAddress({ | ||
@@ -133,24 +133,24 @@ _roots: params.roots.map(utils_1.resolveTvmAddress), | ||
}) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
static getManager(connection, dexRootAddress, cachedState) { | ||
return (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
static async getManager(connection, dexRootAddress, cachedState) { | ||
const result = await (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
.methods.getManager({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
static getOwner(connection, dexRootAddress, cachedState) { | ||
return (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
static async getOwner(connection, dexRootAddress, cachedState) { | ||
const result = await (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
.methods.getOwner({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.dex_owner); | ||
.call({ cachedState, responsible: true }); | ||
return result.dex_owner; | ||
} | ||
static getVault(connection, dexRootAddress, cachedState) { | ||
return (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
static async getVault(connection, dexRootAddress, cachedState) { | ||
const result = await (0, contracts_1.dexRootContract)(connection, dexRootAddress) | ||
.methods.getVault({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
} | ||
exports.DexUtils = DexUtils; |
@@ -21,1 +21,2 @@ "use strict"; | ||
__exportStar(require("../../models/dex/DexUtils"), exports); | ||
__exportStar(require("../../models/dex/types"), exports); |
@@ -121,3 +121,3 @@ "use strict"; | ||
.methods.balance({ answerId: 0 }) | ||
.call({ cachedState: state }) | ||
.call({ cachedState: state, responsible: true }) | ||
.then(async (result) => { | ||
@@ -142,17 +142,25 @@ if (process.env.NODE_ENV !== 'production') { | ||
} | ||
static owner(connection, tokenWalletAddress, cachedState) { | ||
return (0, contracts_1.tokenWalletContract)(connection, tokenWalletAddress) | ||
.methods.owner({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.value0) | ||
.catch(() => undefined); | ||
static async owner(connection, tokenWalletAddress, cachedState) { | ||
try { | ||
const result = await (0, contracts_1.tokenWalletContract)(connection, tokenWalletAddress) | ||
.methods.owner({ answerId: 0 }) | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
catch { | ||
return undefined; | ||
} | ||
} | ||
static root(connection, tokenWalletAddress, cachedState) { | ||
return (0, contracts_1.tokenWalletContract)(connection, tokenWalletAddress) | ||
.methods.root({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.value0) | ||
.catch(() => undefined); | ||
static async root(connection, tokenWalletAddress, cachedState) { | ||
try { | ||
const result = await (0, contracts_1.tokenWalletContract)(connection, tokenWalletAddress) | ||
.methods.root({ answerId: 0 }) | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
catch { | ||
return undefined; | ||
} | ||
} | ||
} | ||
exports.TvmTokenWalletUtils = TvmTokenWalletUtils; |
@@ -134,3 +134,3 @@ "use strict"; | ||
.methods.decimals({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return parseInt(result.value0, 10); | ||
@@ -141,3 +141,3 @@ } | ||
.methods.symbol({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -148,3 +148,3 @@ } | ||
.methods.name({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -155,3 +155,3 @@ } | ||
.methods.rootOwner({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -162,3 +162,3 @@ } | ||
.methods.totalSupply({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -179,3 +179,3 @@ } | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -182,0 +182,0 @@ const providerState = await connection.getProviderState(); |
@@ -59,3 +59,4 @@ import { type Address, type ProviderRpcClient, type SendInternalParams, type Subscriber, type Transaction } from 'everscale-inpage-provider'; | ||
} | ||
export type DexAccountCreateOptions = DexAccountCtorOptions & Syncable & Watchable; | ||
export interface DexAccountCreateOptions extends DexAccountCtorOptions, Syncable, Watchable { | ||
} | ||
export type DexAccountCreateConfig = { | ||
@@ -62,0 +63,0 @@ address: Address | string; |
@@ -162,4 +162,4 @@ import { debug, groupCollapsed, groupEnd, sliceAddress } from '@broxus/js-utils'; | ||
*/ | ||
static getBalance(connection, dexAccountAddress, tokenAddress, cachedState) { | ||
return dexAccountContract(connection, dexAccountAddress) | ||
static async getBalance(connection, dexAccountAddress, tokenAddress, cachedState) { | ||
const result = await dexAccountContract(connection, dexAccountAddress) | ||
.methods.getWalletData({ | ||
@@ -169,4 +169,4 @@ answerId: 0, | ||
}) | ||
.call({ cachedState }) | ||
.then(result => result.balance); | ||
.call({ cachedState, responsible: true }); | ||
return result.balance; | ||
} | ||
@@ -211,7 +211,7 @@ /** | ||
*/ | ||
static getVersion(connection, dexAccountAddress, cachedState) { | ||
return dexAccountContract(connection, dexAccountAddress) | ||
static async getVersion(connection, dexAccountAddress, cachedState) { | ||
const result = await dexAccountContract(connection, dexAccountAddress) | ||
.methods.getVersion({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
@@ -226,4 +226,4 @@ /** | ||
*/ | ||
static getWallet(connection, dexAccountAddress, tokenAddress, cachedState) { | ||
return dexAccountContract(connection, dexAccountAddress) | ||
static async getWallet(connection, dexAccountAddress, tokenAddress, cachedState) { | ||
const result = await dexAccountContract(connection, dexAccountAddress) | ||
.methods.getWalletData({ | ||
@@ -233,4 +233,4 @@ answerId: 0, | ||
}) | ||
.call({ cachedState }) | ||
.then(result => result.wallet); | ||
.call({ cachedState, responsible: true }); | ||
return result.wallet; | ||
} | ||
@@ -237,0 +237,0 @@ /** |
import { type Address, type DecodedAbiFunctionOutputs, type FullContractState, type ProviderRpcClient } from 'everscale-inpage-provider'; | ||
import { type DexPairAbi } from '../../models/dex-pair/abi/DexPair.abi'; | ||
import { type CallId } from '../../types'; | ||
import { DexPoolType } from '../../models/dex'; | ||
export interface DexPairCrossExchangePayloadAbiParams extends Partial<CallId> { | ||
@@ -72,7 +73,2 @@ deployWalletGrams?: string | number; | ||
} | ||
export declare enum DexPairType { | ||
CONSTANT_PRODUCT = "1", | ||
STABLE_PAIR = "2", | ||
STABLE_POOL = "3" | ||
} | ||
export interface DexPairTokenDetails { | ||
@@ -92,3 +88,3 @@ address: Address; | ||
tokens: [leftToken: DexPairTokenDetails, rightToken: DexPairTokenDetails]; | ||
type?: DexPairType; | ||
type?: DexPoolType; | ||
} | ||
@@ -102,3 +98,3 @@ export declare abstract class DexPairUtils { | ||
static getTokenWallets(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<DecodedAbiFunctionOutputs<typeof DexPairAbi, 'getTokenWallets'>>; | ||
static getPoolType(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<DexPairType>; | ||
static getPoolType(connection: ProviderRpcClient, pairAddress: Address | string, cachedState?: FullContractState): Promise<DexPoolType>; | ||
static buildCrossPairExchangePayload(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairCrossExchangePayloadAbiParams, cachedState?: FullContractState): Promise<string>; | ||
@@ -105,0 +101,0 @@ static buildExchangePayload(connection: ProviderRpcClient, pairAddress: Address | string, params: DexPairExchangePayloadAbiParams, cachedState?: FullContractState): Promise<string>; |
import { dexPairContract } from '../../models/dex-pair/contracts'; | ||
import { TvmToken } from '../../models/tvm-token'; | ||
import { getFullContractState, getRandomUint, resolveTvmAddress } from '../../utils'; | ||
export var DexPairType; | ||
(function (DexPairType) { | ||
DexPairType["CONSTANT_PRODUCT"] = "1"; | ||
DexPairType["STABLE_PAIR"] = "2"; | ||
DexPairType["STABLE_POOL"] = "3"; | ||
})(DexPairType || (DexPairType = {})); | ||
export class DexPairUtils { | ||
@@ -11,0 +5,0 @@ static async getDetails(connection, pairAddress, cachedState) { |
@@ -54,3 +54,3 @@ import { dexStablePoolContract } from '../../models/dex-stable-pool/contracts'; | ||
.methods.getBalances({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -64,3 +64,3 @@ lpSupply: result.value0.lp_supply, | ||
.methods.getVirtualPrice({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -91,3 +91,3 @@ } | ||
.methods.getFeeParams({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -104,3 +104,3 @@ beneficiaryAddress: result.value0.beneficiary, | ||
.methods.getRoot({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.dex_root; | ||
@@ -111,3 +111,3 @@ } | ||
.methods.getVault({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.dex_vault; | ||
@@ -118,3 +118,3 @@ } | ||
.methods.isActive({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -125,3 +125,3 @@ } | ||
.methods.getTokenRoots({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -224,3 +224,3 @@ lp: results.lp, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -244,3 +244,3 @@ amounts: result.value0.amounts, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -259,3 +259,3 @@ expectedFee: result.expected_fee, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -273,3 +273,3 @@ expectedAmount: result.expected_amount, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -286,3 +286,3 @@ expectedFee: result.expected_fee, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return ({ | ||
@@ -306,5 +306,5 @@ amounts: result.value0.amounts, | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
} |
@@ -82,4 +82,4 @@ import { dexRootContract } from '../../models/dex/contracts'; | ||
*/ | ||
static getExpectedAccountAddress(connection, dexRootAddress, params, cachedState) { | ||
return dexRootContract(connection, dexRootAddress) | ||
static async getExpectedAccountAddress(connection, dexRootAddress, params, cachedState) { | ||
const result = await dexRootContract(connection, dexRootAddress) | ||
.methods.getExpectedAccountAddress({ | ||
@@ -89,4 +89,4 @@ account_owner: resolveTvmAddress(params.ownerAddress), | ||
}) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
@@ -102,4 +102,4 @@ /** | ||
*/ | ||
static getExpectedPairAddress(connection, dexRootAddress, params, cachedState) { | ||
return dexRootContract(connection, dexRootAddress) | ||
static async getExpectedPairAddress(connection, dexRootAddress, params, cachedState) { | ||
const result = await dexRootContract(connection, dexRootAddress) | ||
.methods.getExpectedPairAddress({ | ||
@@ -110,4 +110,4 @@ answerId: 0, | ||
}) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
@@ -123,4 +123,4 @@ /** | ||
*/ | ||
static getExpectedPoolAddress(connection, dexRootAddress, params, cachedState) { | ||
return dexRootContract(connection, dexRootAddress) | ||
static async getExpectedPoolAddress(connection, dexRootAddress, params, cachedState) { | ||
const result = await dexRootContract(connection, dexRootAddress) | ||
.methods.getExpectedPoolAddress({ | ||
@@ -130,23 +130,23 @@ _roots: params.roots.map(resolveTvmAddress), | ||
}) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
static getManager(connection, dexRootAddress, cachedState) { | ||
return dexRootContract(connection, dexRootAddress) | ||
static async getManager(connection, dexRootAddress, cachedState) { | ||
const result = await dexRootContract(connection, dexRootAddress) | ||
.methods.getManager({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
static getOwner(connection, dexRootAddress, cachedState) { | ||
return dexRootContract(connection, dexRootAddress) | ||
static async getOwner(connection, dexRootAddress, cachedState) { | ||
const result = await dexRootContract(connection, dexRootAddress) | ||
.methods.getOwner({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.dex_owner); | ||
.call({ cachedState, responsible: true }); | ||
return result.dex_owner; | ||
} | ||
static getVault(connection, dexRootAddress, cachedState) { | ||
return dexRootContract(connection, dexRootAddress) | ||
static async getVault(connection, dexRootAddress, cachedState) { | ||
const result = await dexRootContract(connection, dexRootAddress) | ||
.methods.getVault({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.value0); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
} |
@@ -5,1 +5,2 @@ export * from '../../models/dex/abi/DexRoot.abi'; | ||
export * from '../../models/dex/DexUtils'; | ||
export * from '../../models/dex/types'; |
@@ -5,1 +5,2 @@ export * from '../../models/dex/abi/DexRoot.abi'; | ||
export * from '../../models/dex/DexUtils'; | ||
export * from '../../models/dex/types'; |
@@ -118,3 +118,3 @@ import { debug, groupCollapsed, groupEnd, sliceAddress } from '@broxus/js-utils'; | ||
.methods.balance({ answerId: 0 }) | ||
.call({ cachedState: state }) | ||
.call({ cachedState: state, responsible: true }) | ||
.then(async (result) => { | ||
@@ -139,16 +139,24 @@ if (process.env.NODE_ENV !== 'production') { | ||
} | ||
static owner(connection, tokenWalletAddress, cachedState) { | ||
return tokenWalletContract(connection, tokenWalletAddress) | ||
.methods.owner({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.value0) | ||
.catch(() => undefined); | ||
static async owner(connection, tokenWalletAddress, cachedState) { | ||
try { | ||
const result = await tokenWalletContract(connection, tokenWalletAddress) | ||
.methods.owner({ answerId: 0 }) | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
catch { | ||
return undefined; | ||
} | ||
} | ||
static root(connection, tokenWalletAddress, cachedState) { | ||
return tokenWalletContract(connection, tokenWalletAddress) | ||
.methods.root({ answerId: 0 }) | ||
.call({ cachedState }) | ||
.then(result => result.value0) | ||
.catch(() => undefined); | ||
static async root(connection, tokenWalletAddress, cachedState) { | ||
try { | ||
const result = await tokenWalletContract(connection, tokenWalletAddress) | ||
.methods.root({ answerId: 0 }) | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
} | ||
catch { | ||
return undefined; | ||
} | ||
} | ||
} |
@@ -131,3 +131,3 @@ import { debug, formattedTokenAmount, groupCollapsed, groupEnd, sliceAddress } from '@broxus/js-utils'; | ||
.methods.decimals({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return parseInt(result.value0, 10); | ||
@@ -138,3 +138,3 @@ } | ||
.methods.symbol({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -145,3 +145,3 @@ } | ||
.methods.name({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -152,3 +152,3 @@ } | ||
.methods.rootOwner({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -159,3 +159,3 @@ } | ||
.methods.totalSupply({ answerId: 0 }) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
return result.value0; | ||
@@ -176,3 +176,3 @@ } | ||
}) | ||
.call({ cachedState }); | ||
.call({ cachedState, responsible: true }); | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -179,0 +179,0 @@ const providerState = await connection.getProviderState(); |
{ | ||
"name": "@broxus/js-core", | ||
"version": "0.13.2", | ||
"version": "0.13.3", | ||
"description": "MobX-based JavaScript Core library", | ||
@@ -63,3 +63,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "792a63b805b3a83a6fd978c511ba338da0c27369" | ||
"gitHead": "d5615f1e7419842a35649875432c71a2ea4b8e06" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1239006
258
26648