@allbridge/bridge-core-sdk 3.19.1-alpha.1 → 3.20.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +5 -5
- package/dist/browser/index.js.map +4 -4
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +4 -4
- package/dist/src/chains/chain.enums.js +2 -2
- package/dist/src/chains/chain.enums.js.map +1 -1
- package/dist/src/chains/index.js.map +1 -1
- package/dist/src/chains/models.js.map +1 -1
- package/dist/src/client/core-api/api-client-caching.js +5 -0
- package/dist/src/client/core-api/api-client-caching.js.map +1 -1
- package/dist/src/client/core-api/api-client.js +1 -0
- package/dist/src/client/core-api/api-client.js.map +1 -1
- package/dist/src/client/core-api/core-api-mapper.js +6 -8
- package/dist/src/client/core-api/core-api-mapper.js.map +1 -1
- package/dist/src/client/core-api/core-api.model.js +3 -3
- package/dist/src/client/core-api/core-api.model.js.map +1 -1
- package/dist/src/client/core-api/core-client-base.js +1 -0
- package/dist/src/client/core-api/core-client-base.js.map +1 -1
- package/dist/src/client/core-api/core-client-filtered.js +2 -0
- package/dist/src/client/core-api/core-client-filtered.js.map +1 -1
- package/dist/src/client/core-api/core-client-pool-info-caching.js +3 -1
- package/dist/src/client/core-api/core-client-pool-info-caching.js.map +1 -1
- package/dist/src/configs/index.js.map +1 -1
- package/dist/src/configs/mainnet.d.ts +1 -1
- package/dist/src/configs/mainnet.js +1 -1
- package/dist/src/configs/mainnet.js.map +1 -1
- package/dist/src/exceptions/exceptions.js +2 -1
- package/dist/src/exceptions/exceptions.js.map +1 -1
- package/dist/src/exceptions/index.js.map +1 -1
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.js +11 -6
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/index.js +2 -2
- package/dist/src/models/index.js.map +1 -1
- package/dist/src/services/bridge/evm/index.d.ts +6 -8
- package/dist/src/services/bridge/evm/index.js +14 -12
- package/dist/src/services/bridge/evm/index.js.map +1 -1
- package/dist/src/services/bridge/index.d.ts +3 -4
- package/dist/src/services/bridge/index.js +16 -11
- package/dist/src/services/bridge/index.js.map +1 -1
- package/dist/src/services/bridge/models/bridge.d.ts +1 -1
- package/dist/src/services/bridge/models/bridge.js.map +1 -1
- package/dist/src/services/bridge/models/bridge.model.d.ts +18 -10
- package/dist/src/services/bridge/models/bridge.model.js.map +1 -1
- package/dist/src/services/bridge/models/index.js.map +1 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js +4 -0
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js.map +1 -1
- package/dist/src/services/bridge/sol/index.d.ts +2 -2
- package/dist/src/services/bridge/sol/index.js +5 -5
- package/dist/src/services/bridge/sol/index.js.map +1 -1
- package/dist/src/services/bridge/sol/jupiter.js +2 -0
- package/dist/src/services/bridge/sol/jupiter.js.map +1 -1
- package/dist/src/services/bridge/srb/index.d.ts +3 -3
- package/dist/src/services/bridge/srb/index.js +4 -1
- package/dist/src/services/bridge/srb/index.js.map +1 -1
- package/dist/src/services/bridge/trx/index.d.ts +6 -6
- package/dist/src/services/bridge/trx/index.js +5 -3
- package/dist/src/services/bridge/trx/index.js.map +1 -1
- package/dist/src/services/bridge/utils.d.ts +12 -3
- package/dist/src/services/bridge/utils.js +22 -40
- package/dist/src/services/bridge/utils.js.map +1 -1
- package/dist/src/services/index.js +7 -3
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/evm/index.d.ts +4 -6
- package/dist/src/services/liquidity-pool/evm/index.js +102 -47
- package/dist/src/services/liquidity-pool/evm/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/index.d.ts +1 -1
- package/dist/src/services/liquidity-pool/index.js +14 -7
- package/dist/src/services/liquidity-pool/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/models/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/models/pool.js.map +1 -1
- package/dist/src/services/liquidity-pool/models/pool.model.js +2 -0
- package/dist/src/services/liquidity-pool/models/pool.model.js.map +1 -1
- package/dist/src/services/liquidity-pool/raw-pool-transaction-builder.js +4 -0
- package/dist/src/services/liquidity-pool/raw-pool-transaction-builder.js.map +1 -1
- package/dist/src/services/liquidity-pool/sol/index.js +7 -5
- package/dist/src/services/liquidity-pool/sol/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/srb/index.js +5 -2
- package/dist/src/services/liquidity-pool/srb/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/trx/index.d.ts +4 -5
- package/dist/src/services/liquidity-pool/trx/index.js +94 -38
- package/dist/src/services/liquidity-pool/trx/index.js.map +1 -1
- package/dist/src/services/models/abi/Bridge.d.ts +715 -0
- package/dist/src/services/models/abi/Bridge.js +925 -0
- package/dist/src/services/models/abi/Bridge.js.map +1 -0
- package/dist/src/services/models/abi/CctpBridge.d.ts +446 -0
- package/dist/src/services/models/abi/CctpBridge.js +575 -0
- package/dist/src/services/models/abi/CctpBridge.js.map +1 -0
- package/dist/src/services/models/abi/ERC20.d.ts +222 -0
- package/dist/src/services/models/abi/ERC20.js +294 -0
- package/dist/src/services/models/abi/ERC20.js.map +1 -0
- package/dist/src/services/models/abi/Pool.d.ts +746 -0
- package/dist/src/services/models/abi/Pool.js +965 -0
- package/dist/src/services/models/abi/Pool.js.map +1 -0
- package/dist/src/services/models/index.d.ts +35 -9
- package/dist/src/services/models/index.js.map +1 -1
- package/dist/src/services/models/sol/index.d.ts +2 -4
- package/dist/src/services/models/sol/index.js +1 -1
- package/dist/src/services/models/sol/index.js.map +1 -1
- package/dist/src/services/models/sol/types/bridge.js.map +1 -1
- package/dist/src/services/models/sol/types/cctp_bridge.js.map +1 -1
- package/dist/src/services/models/sol/types/gas_oracle.js.map +1 -1
- package/dist/src/services/models/srb/bridge-contract.d.ts +0 -1
- package/dist/src/services/models/srb/bridge-contract.js +32 -31
- package/dist/src/services/models/srb/bridge-contract.js.map +1 -1
- package/dist/src/services/models/srb/gas-oracle-contract.d.ts +0 -1
- package/dist/src/services/models/srb/gas-oracle-contract.js +13 -12
- package/dist/src/services/models/srb/gas-oracle-contract.js.map +1 -1
- package/dist/src/services/models/srb/messenger-contract.d.ts +0 -1
- package/dist/src/services/models/srb/messenger-contract.js +23 -22
- package/dist/src/services/models/srb/messenger-contract.js.map +1 -1
- package/dist/src/services/models/srb/pool-contract.d.ts +0 -1
- package/dist/src/services/models/srb/pool-contract.js +28 -27
- package/dist/src/services/models/srb/pool-contract.js.map +1 -1
- package/dist/src/services/models/srb/token-contract.js +19 -18
- package/dist/src/services/models/srb/token-contract.js.map +1 -1
- package/dist/src/services/models/srb/utils.js +3 -4
- package/dist/src/services/models/srb/utils.js.map +1 -1
- package/dist/src/services/token/evm/index.d.ts +5 -7
- package/dist/src/services/token/evm/index.js +24 -23
- package/dist/src/services/token/evm/index.js.map +1 -1
- package/dist/src/services/token/index.js +7 -8
- package/dist/src/services/token/index.js.map +1 -1
- package/dist/src/services/token/models/index.js.map +1 -1
- package/dist/src/services/token/models/token.js.map +1 -1
- package/dist/src/services/token/models/token.model.js.map +1 -1
- package/dist/src/services/token/sol/index.js +3 -2
- package/dist/src/services/token/sol/index.js.map +1 -1
- package/dist/src/services/token/srb/index.js +4 -1
- package/dist/src/services/token/srb/index.js.map +1 -1
- package/dist/src/services/token/trx/index.d.ts +3 -3
- package/dist/src/services/token/trx/index.js +7 -5
- package/dist/src/services/token/trx/index.js.map +1 -1
- package/dist/src/services/utils/calculation/index.js +2 -3
- package/dist/src/services/utils/calculation/index.js.map +1 -1
- package/dist/src/services/utils/index.js +5 -9
- package/dist/src/services/utils/index.js.map +1 -1
- package/dist/src/services/utils/sol/accounts.d.ts +0 -1
- package/dist/src/services/utils/sol/accounts.js +19 -20
- package/dist/src/services/utils/sol/accounts.js.map +1 -1
- package/dist/src/services/utils/sol/anchor-provider.js +1 -2
- package/dist/src/services/utils/sol/anchor-provider.js.map +1 -1
- package/dist/src/services/utils/sol/compute-budget.js +2 -3
- package/dist/src/services/utils/sol/compute-budget.js.map +1 -1
- package/dist/src/services/utils/sol/index.d.ts +0 -1
- package/dist/src/services/utils/sol/index.js +8 -9
- package/dist/src/services/utils/sol/index.js.map +1 -1
- package/dist/src/services/utils/trx/index.d.ts +1 -1
- package/dist/src/services/utils/trx/index.js +3 -6
- package/dist/src/services/utils/trx/index.js.map +1 -1
- package/dist/src/tokens-info/index.js +4 -0
- package/dist/src/tokens-info/index.js.map +1 -1
- package/dist/src/tokens-info/tokens-info.model.d.ts +1 -1
- package/dist/src/tokens-info/tokens-info.model.js.map +1 -1
- package/dist/src/utils/calculation/constants.js.map +1 -1
- package/dist/src/utils/calculation/index.js +17 -18
- package/dist/src/utils/calculation/index.js.map +1 -1
- package/dist/src/utils/calculation/swap-and-bridge-details.js +1 -2
- package/dist/src/utils/calculation/swap-and-bridge-details.js.map +1 -1
- package/dist/src/utils/calculation/swap-and-bridge-fee-calc.js +2 -3
- package/dist/src/utils/calculation/swap-and-bridge-fee-calc.js.map +1 -1
- package/dist/src/utils/index.js +3 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/sol/index.js +2 -0
- package/dist/src/utils/sol/index.js.map +1 -1
- package/dist/src/utils/sol/utils.js +1 -2
- package/dist/src/utils/sol/utils.js.map +1 -1
- package/dist/src/utils/srb/index.d.ts +1 -1
- package/dist/src/utils/srb/index.js +7 -5
- package/dist/src/utils/srb/index.js.map +1 -1
- package/dist/src/utils/utils.js +7 -9
- package/dist/src/utils/utils.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +55 -53
- package/dist/src/services/models/abi/Bridge.json +0 -919
- package/dist/src/services/models/abi/CctpBridge.json +0 -569
- package/dist/src/services/models/abi/ERC20.json +0 -288
- package/dist/src/services/models/abi/Pool.json +0 -959
- package/dist/src/services/models/abi/types/Bridge.d.ts +0 -145
- package/dist/src/services/models/abi/types/Bridge.js +0 -6
- package/dist/src/services/models/abi/types/Bridge.js.map +0 -1
- package/dist/src/services/models/abi/types/CctpBridge.d.ts +0 -117
- package/dist/src/services/models/abi/types/CctpBridge.js +0 -6
- package/dist/src/services/models/abi/types/CctpBridge.js.map +0 -1
- package/dist/src/services/models/abi/types/Pool.d.ts +0 -164
- package/dist/src/services/models/abi/types/Pool.js +0 -6
- package/dist/src/services/models/abi/types/Pool.js.map +0 -1
- package/dist/src/services/models/abi/types/index.d.ts +0 -2
- package/dist/src/services/models/abi/types/index.js +0 -3
- package/dist/src/services/models/abi/types/index.js.map +0 -1
- package/dist/src/services/models/abi/types/types.d.ts +0 -54
- package/dist/src/services/models/abi/types/types.js +0 -3
- package/dist/src/services/models/abi/types/types.js.map +0 -1
|
@@ -48,6 +48,7 @@ exports.Errors = {
|
|
|
48
48
|
};
|
|
49
49
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
50
50
|
class PoolContract extends ContractClient {
|
|
51
|
+
options;
|
|
51
52
|
constructor(options) {
|
|
52
53
|
super(new ContractSpec([
|
|
53
54
|
"AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAABwAAAAAAAAAFYWRtaW4AAAAAAAATAAAAAAAAAAZicmlkZ2UAAAAAABMAAAAAAAAAAWEAAAAAAAAKAAAAAAAAAAV0b2tlbgAAAAAAABMAAAAAAAAADGZlZV9zaGFyZV9icAAAAAoAAAAAAAAAFGJhbGFuY2VfcmF0aW9fbWluX2JwAAAACgAAAAAAAAASYWRtaW5fZmVlX3NoYXJlX2JwAAAAAAAKAAAAAQAAA+kAAAPtAAAAAAAAAAM=",
|
|
@@ -92,34 +93,34 @@ class PoolContract extends ContractClient {
|
|
|
92
93
|
"AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAAKAAAAAAAAAANVW5pbXBsZW1lbnRlZAAAAAAAAAAAAAAAAAAAC0luaXRpYWxpemVkAAAAAAEAAAAAAAAADVVuaW5pdGlhbGl6ZWQA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zZWQAAADUAAAAAAAAAAxOb3RFbm91Z2hGZWUAAADWAAAAAAAAAAlOb01lc3NhZ2UAAAAAAADXAAAAAAAAAA1Ob1JlY2VpdmVQb29sAAAAAAAA2AAAAAAAAAAGTm9Qb29sAAAAAADZAAAAAAAAABNVbmtub3duQW5vdGhlclRva2VuAAAAANoAAAAAAAAAD1dyb25nQnl0ZUxlbmd0aAAAAAEsAAAAAAAAAApIYXNNZXNzYWdlAAAAAAEtAAAAAAAAABdJbnZhbGlkUHJpbWFyeVNpZ25hdHVyZQAAAAEuAAAAAAAAABlJbnZhbGlkU2Vjb25kYXJ5U2lnbmF0dXJlAAAAAAABLwAAAAAAAAARTm9HYXNEYXRhRm9yQ2hhaW4AAAAAAAGQ",
|
|
93
94
|
]), options);
|
|
94
95
|
this.options = options;
|
|
95
|
-
this.fromJSON = {
|
|
96
|
-
initialize: (this.txFromJSON),
|
|
97
|
-
deposit: (this.txFromJSON),
|
|
98
|
-
withdraw: (this.txFromJSON),
|
|
99
|
-
swap_to_v_usd: (this.txFromJSON),
|
|
100
|
-
swap_from_v_usd: (this.txFromJSON),
|
|
101
|
-
claim_rewards: (this.txFromJSON),
|
|
102
|
-
set_fee_share: (this.txFromJSON),
|
|
103
|
-
adjust_total_lp_amount: (this.txFromJSON),
|
|
104
|
-
set_balance_ratio_min_bp: (this.txFromJSON),
|
|
105
|
-
stop_deposit: (this.txFromJSON),
|
|
106
|
-
start_deposit: (this.txFromJSON),
|
|
107
|
-
stop_withdraw: (this.txFromJSON),
|
|
108
|
-
start_withdraw: (this.txFromJSON),
|
|
109
|
-
set_stop_authority: (this.txFromJSON),
|
|
110
|
-
set_bridge: (this.txFromJSON),
|
|
111
|
-
set_admin: (this.txFromJSON),
|
|
112
|
-
set_admin_fee_share: (this.txFromJSON),
|
|
113
|
-
claim_admin_fee: (this.txFromJSON),
|
|
114
|
-
pending_reward: (this.txFromJSON),
|
|
115
|
-
get_pool: (this.txFromJSON),
|
|
116
|
-
get_admin: (this.txFromJSON),
|
|
117
|
-
get_stop_authority: (this.txFromJSON),
|
|
118
|
-
get_bridge: (this.txFromJSON),
|
|
119
|
-
get_user_deposit: (this.txFromJSON),
|
|
120
|
-
upgrade: (this.txFromJSON),
|
|
121
|
-
};
|
|
122
96
|
}
|
|
97
|
+
fromJSON = {
|
|
98
|
+
initialize: (this.txFromJSON),
|
|
99
|
+
deposit: (this.txFromJSON),
|
|
100
|
+
withdraw: (this.txFromJSON),
|
|
101
|
+
swap_to_v_usd: (this.txFromJSON),
|
|
102
|
+
swap_from_v_usd: (this.txFromJSON),
|
|
103
|
+
claim_rewards: (this.txFromJSON),
|
|
104
|
+
set_fee_share: (this.txFromJSON),
|
|
105
|
+
adjust_total_lp_amount: (this.txFromJSON),
|
|
106
|
+
set_balance_ratio_min_bp: (this.txFromJSON),
|
|
107
|
+
stop_deposit: (this.txFromJSON),
|
|
108
|
+
start_deposit: (this.txFromJSON),
|
|
109
|
+
stop_withdraw: (this.txFromJSON),
|
|
110
|
+
start_withdraw: (this.txFromJSON),
|
|
111
|
+
set_stop_authority: (this.txFromJSON),
|
|
112
|
+
set_bridge: (this.txFromJSON),
|
|
113
|
+
set_admin: (this.txFromJSON),
|
|
114
|
+
set_admin_fee_share: (this.txFromJSON),
|
|
115
|
+
claim_admin_fee: (this.txFromJSON),
|
|
116
|
+
pending_reward: (this.txFromJSON),
|
|
117
|
+
get_pool: (this.txFromJSON),
|
|
118
|
+
get_admin: (this.txFromJSON),
|
|
119
|
+
get_stop_authority: (this.txFromJSON),
|
|
120
|
+
get_bridge: (this.txFromJSON),
|
|
121
|
+
get_user_deposit: (this.txFromJSON),
|
|
122
|
+
upgrade: (this.txFromJSON),
|
|
123
|
+
};
|
|
123
124
|
}
|
|
124
125
|
exports.PoolContract = PoolContract;
|
|
125
126
|
//# sourceMappingURL=pool-contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool-contract.js","sourceRoot":"","sources":["../../../../../src/services/models/srb/pool-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AAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QAC5C,eAAe,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QAC9C,aAAa,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QAC5C,aAAa,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QAC5C,sBAAsB,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QACrD,wBAAwB,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QACvD,YAAY,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QAC3C,aAAa,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QAC5C,aAAa,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QAC5C,cAAc,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QAC7C,kBAAkB,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QACjD,UAAU,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QACzC,SAAS,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QACxC,mBAAmB,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QAClD,eAAe,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QAC9C,cAAc,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QAC7C,QAAQ,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;QACvC,SAAS,EAAE,CAAA,IAAI,CAAC,UAA0B,CAAA;QAC1C,kBAAkB,EAAE,CAAA,IAAI,CAAC,UAA0B,CAAA;QACnD,UAAU,EAAE,CAAA,IAAI,CAAC,UAA0B,CAAA;QAC3C,gBAAgB,EAAE,CAAA,IAAI,CAAC,UAA+B,CAAA;QACtD,OAAO,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;KACvC,CAAC;CACH;AA3ED,oCA2EC","sourcesContent":["import { contract } from \"@stellar/stellar-sdk\";\nimport u128 = contract.u128;\nimport u32 = contract.u32;\nimport AssembledTransaction = contract.AssembledTransaction;\nimport Result = contract.Result;\nimport ContractSpec = contract.Spec;\nimport ContractClient = contract.Client;\nimport ContractClientOptions = contract.ClientOptions;\n\nexport interface SwappedFromVUsd {\n amount: u128;\n fee: u128;\n recipient: string;\n token: string;\n vusd_amount: u128;\n}\n\nexport interface SwappedToVUsd {\n amount: u128;\n fee: u128;\n sender: string;\n token: string;\n vusd_amount: u128;\n}\n\nexport interface Deposit {\n amount: u128;\n user: string;\n}\n\nexport interface Withdraw {\n amount: u128;\n user: string;\n}\n\nexport interface RewardsClaimed {\n amount: u128;\n user: string;\n}\n\nexport type Bridge = readonly [string];\nexport interface DataKey {\n tag: \"UserDeposit\";\n values: readonly [string];\n}\n\nexport interface Pool {\n a: u128;\n acc_reward_per_share_p: u128;\n admin_fee_amount: u128;\n admin_fee_share_bp: u128;\n balance_ratio_min_bp: u128;\n can_deposit: boolean;\n can_withdraw: boolean;\n d: u128;\n decimals: u32;\n fee_share_bp: u128;\n reserves: u128;\n token: string;\n token_balance: u128;\n total_lp_amount: u128;\n v_usd_balance: u128;\n}\n\nexport interface UserDeposit {\n lp_amount: u128;\n reward_debt: u128;\n}\n\nexport type Admin = readonly [string];\nexport type GasOracleAddress = readonly [string];\nexport type GasUsage = readonly [Map<u32, u128>];\nexport type NativeToken = readonly [string];\nexport type StopAuthority = readonly [string];\nexport const Errors = {\n 0: { message: \"\" },\n 1: { message: \"\" },\n 2: { message: \"\" },\n 3: { message: \"\" },\n 4: { message: \"\" },\n 5: { message: \"\" },\n 6: { message: \"\" },\n 7: { message: \"\" },\n 8: { message: \"\" },\n 9: { message: \"\" },\n 10: { message: \"\" },\n 11: { message: \"\" },\n 12: { message: \"\" },\n 103: { message: \"\" },\n 104: { message: \"\" },\n 105: { message: \"\" },\n 106: { message: \"\" },\n 107: { message: \"\" },\n 108: { message: \"\" },\n 109: { message: \"\" },\n 203: { message: \"\" },\n 204: { message: \"\" },\n 205: { message: \"\" },\n 206: { message: \"\" },\n 207: { message: \"\" },\n 208: { message: \"\" },\n 209: { message: \"\" },\n 210: { message: \"\" },\n 211: { message: \"\" },\n 212: { message: \"\" },\n 214: { message: \"\" },\n 215: { message: \"\" },\n 216: { message: \"\" },\n 217: { message: \"\" },\n 218: { message: \"\" },\n 300: { message: \"\" },\n 301: { message: \"\" },\n 302: { message: \"\" },\n 303: { message: \"\" },\n 400: { message: \"\" },\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport interface PoolContract {\n /**\n * Construct and simulate a initialize transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n initialize: (\n {\n admin,\n bridge,\n a,\n token,\n fee_share_bp,\n balance_ratio_min_bp,\n admin_fee_share_bp,\n }: {\n admin: string;\n bridge: string;\n a: u128;\n token: string;\n fee_share_bp: u128;\n balance_ratio_min_bp: u128;\n admin_fee_share_bp: u128;\n },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a deposit transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n deposit: (\n { sender, amount }: { sender: string; amount: u128 },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a withdraw transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n withdraw: (\n { sender, amount_lp }: { sender: string; amount_lp: u128 },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a swap_to_v_usd transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n swap_to_v_usd: (\n { user, amount, zero_fee }: { user: string; amount: u128; zero_fee: boolean },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<u128>>>;\n\n /**\n * Construct and simulate a swap_from_v_usd transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n swap_from_v_usd: (\n {\n user,\n vusd_amount,\n receive_amount_min,\n zero_fee,\n }: {\n user: string;\n vusd_amount: u128;\n receive_amount_min: u128;\n zero_fee: boolean;\n },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<u128>>>;\n\n /**\n * Construct and simulate a claim_rewards transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n claim_rewards: (\n { sender }: { sender: string },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a set_fee_share transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * `admin`\n */\n set_fee_share: (\n { fee_share_bp }: { fee_share_bp: u128 },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a adjust_total_lp_amount transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n adjust_total_lp_amount: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a set_balance_ratio_min_bp transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n set_balance_ratio_min_bp: (\n { balance_ratio_min_bp }: { balance_ratio_min_bp: u128 },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a stop_deposit transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n stop_deposit: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a start_deposit transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n start_deposit: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a stop_withdraw transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n stop_withdraw: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a start_withdraw transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n start_withdraw: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a set_stop_authority transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n set_stop_authority: (\n { stop_authority }: { stop_authority: string },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a set_bridge transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n set_bridge: (\n { bridge }: { bridge: string },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a set_admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n set_admin: (\n { new_admin }: { new_admin: string },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a set_admin_fee_share transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n set_admin_fee_share: (\n { admin_fee_share_bp }: { admin_fee_share_bp: u128 },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a claim_admin_fee transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n claim_admin_fee: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<Result<void>>>;\n\n /**\n * Construct and simulate a pending_reward transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * `view`\n */\n pending_reward: (\n { user }: { user: string },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<u128>>>;\n\n /**\n * Construct and simulate a get_pool transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n get_pool: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<Result<Pool>>>;\n\n /**\n * Construct and simulate a get_admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n get_admin: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<Result<string>>>;\n\n /**\n * Construct and simulate a get_stop_authority transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n get_stop_authority: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<Result<string>>>;\n\n /**\n * Construct and simulate a get_bridge transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n get_bridge: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<Result<string>>>;\n\n /**\n * Construct and simulate a get_user_deposit transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n get_user_deposit: (\n { user }: { user: string },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<UserDeposit>>>;\n\n /**\n * Construct and simulate a upgrade transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.\n */\n upgrade: (\n { new_wasm_hash }: { new_wasm_hash: Buffer },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<Result<void>>>;\n}\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport class PoolContract extends ContractClient {\n constructor(public readonly options: ContractClientOptions) {\n super(\n new ContractSpec([\n \"AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAABwAAAAAAAAAFYWRtaW4AAAAAAAATAAAAAAAAAAZicmlkZ2UAAAAAABMAAAAAAAAAAWEAAAAAAAAKAAAAAAAAAAV0b2tlbgAAAAAAABMAAAAAAAAADGZlZV9zaGFyZV9icAAAAAoAAAAAAAAAFGJhbGFuY2VfcmF0aW9fbWluX2JwAAAACgAAAAAAAAASYWRtaW5fZmVlX3NoYXJlX2JwAAAAAAAKAAAAAQAAA+kAAAPtAAAAAAAAAAM=\",\n \"AAAAAAAAAAAAAAAHZGVwb3NpdAAAAAACAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAABmFtb3VudAAAAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD\",\n \"AAAAAAAAAAAAAAAId2l0aGRyYXcAAAACAAAAAAAAAAZzZW5kZXIAAAAAABMAAAAAAAAACWFtb3VudF9scAAAAAAAAAoAAAABAAAD6QAAA+0AAAAAAAAAAw==\",\n \"AAAAAAAAAAAAAAANc3dhcF90b192X3VzZAAAAAAAAAMAAAAAAAAABHVzZXIAAAATAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAACHplcm9fZmVlAAAAAQAAAAEAAAPpAAAACgAAAAM=\",\n \"AAAAAAAAAAAAAAAPc3dhcF9mcm9tX3ZfdXNkAAAAAAQAAAAAAAAABHVzZXIAAAATAAAAAAAAAAt2dXNkX2Ftb3VudAAAAAAKAAAAAAAAABJyZWNlaXZlX2Ftb3VudF9taW4AAAAAAAoAAAAAAAAACHplcm9fZmVlAAAAAQAAAAEAAAPpAAAACgAAAAM=\",\n \"AAAAAAAAAAAAAAANY2xhaW1fcmV3YXJkcwAAAAAAAAEAAAAAAAAABnNlbmRlcgAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD\",\n \"AAAAAAAAAAdgYWRtaW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withdraw: this.txFromJSON<Result<void>>,\n swap_to_v_usd: this.txFromJSON<Result<u128>>,\n swap_from_v_usd: this.txFromJSON<Result<u128>>,\n claim_rewards: this.txFromJSON<Result<void>>,\n set_fee_share: this.txFromJSON<Result<void>>,\n adjust_total_lp_amount: this.txFromJSON<Result<void>>,\n set_balance_ratio_min_bp: this.txFromJSON<Result<void>>,\n stop_deposit: this.txFromJSON<Result<void>>,\n start_deposit: this.txFromJSON<Result<void>>,\n stop_withdraw: this.txFromJSON<Result<void>>,\n start_withdraw: this.txFromJSON<Result<void>>,\n set_stop_authority: this.txFromJSON<Result<void>>,\n set_bridge: this.txFromJSON<Result<void>>,\n set_admin: this.txFromJSON<Result<void>>,\n set_admin_fee_share: this.txFromJSON<Result<void>>,\n claim_admin_fee: this.txFromJSON<Result<void>>,\n pending_reward: this.txFromJSON<Result<u128>>,\n get_pool: this.txFromJSON<Result<Pool>>,\n get_admin: this.txFromJSON<Result<string>>,\n get_stop_authority: this.txFromJSON<Result<string>>,\n get_bridge: this.txFromJSON<Result<string>>,\n get_user_deposit: this.txFromJSON<Result<UserDeposit>>,\n upgrade: this.txFromJSON<Result<void>>,\n };\n}\n"]}
|
|
@@ -7,6 +7,7 @@ var ContractClient = stellar_sdk_1.contract.Client;
|
|
|
7
7
|
exports.Errors = {};
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
9
9
|
class TokenContract extends ContractClient {
|
|
10
|
+
options;
|
|
10
11
|
constructor(options) {
|
|
11
12
|
super(new ContractSpec([
|
|
12
13
|
"AAAAAAAAAYlSZXR1cm5zIHRoZSBhbGxvd2FuY2UgZm9yIGBzcGVuZGVyYCB0byB0cmFuc2ZlciBmcm9tIGBmcm9tYC4KClRoZSBhbW91bnQgcmV0dXJuZWQgaXMgdGhlIGFtb3VudCB0aGF0IHNwZW5kZXIgaXMgYWxsb3dlZCB0byB0cmFuc2ZlcgpvdXQgb2YgZnJvbSdzIGJhbGFuY2UuIFdoZW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dXRob3JpemluZyB0aGUgdHJhbnNmZXIsIGFuZCBoYXZpbmcgaXRzCmFsbG93YW5jZSBjb25zdW1lZCBkdXJpbmcgdGhlIHRyYW5zZmVyLgoqIGBmcm9tYCAtIFRoZSBhZGRyZXNzIGhvbGRpbmcgdGhlIGJhbGFuY2Ugb2YgdG9rZW5zIHdoaWNoIHdpbGwgYmUKd2l0aGRyYXduIGZyb20uCiogYHRvYCAtIFRoZSBhZGRyZXNzIHdoaWNoIHdpbGwgcmVjZWl2ZSB0aGUgdHJhbnNmZXJyZWQgdG9rZW5zLgoqIGBhbW91bnRgIC0gVGhlIGFtb3VudCBvZiB0b2tlbnMgdG8gYmUgdHJhbnNmZXJyZWQuCgojIEV2ZW50cwoKRW1pdHMgYW4gZXZlbnQgd2l0aCB0b3BpY3MgYFsidHJhbnNmZXIiLCBmcm9tOiBBZGRyZXNzLCB0bzogQWRkcmVzc10sCmRhdGEgPSBbYW1vdW50OiBpMTI4XWAAAAAADXRyYW5zZmVyX2Zyb20AAAAAAAAEAAAAAAAAAAdzcGVuZGVyAAAAABMAAAAAAAAABGZyb20AAAATAAAAAAAAAAJ0bwAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAA==",
|
|
28
29
|
]), options);
|
|
29
30
|
this.options = options;
|
|
30
|
-
this.fromJSON = {
|
|
31
|
-
allowance: (this.txFromJSON),
|
|
32
|
-
authorized: (this.txFromJSON),
|
|
33
|
-
approve: (this.txFromJSON),
|
|
34
|
-
balance: (this.txFromJSON),
|
|
35
|
-
burn: (this.txFromJSON),
|
|
36
|
-
burn_from: (this.txFromJSON),
|
|
37
|
-
clawback: (this.txFromJSON),
|
|
38
|
-
decimals: (this.txFromJSON),
|
|
39
|
-
mint: (this.txFromJSON),
|
|
40
|
-
name: (this.txFromJSON),
|
|
41
|
-
set_admin: (this.txFromJSON),
|
|
42
|
-
admin: (this.txFromJSON),
|
|
43
|
-
set_authorized: (this.txFromJSON),
|
|
44
|
-
symbol: (this.txFromJSON),
|
|
45
|
-
transfer: (this.txFromJSON),
|
|
46
|
-
transfer_from: (this.txFromJSON),
|
|
47
|
-
};
|
|
48
31
|
}
|
|
32
|
+
fromJSON = {
|
|
33
|
+
allowance: (this.txFromJSON),
|
|
34
|
+
authorized: (this.txFromJSON),
|
|
35
|
+
approve: (this.txFromJSON),
|
|
36
|
+
balance: (this.txFromJSON),
|
|
37
|
+
burn: (this.txFromJSON),
|
|
38
|
+
burn_from: (this.txFromJSON),
|
|
39
|
+
clawback: (this.txFromJSON),
|
|
40
|
+
decimals: (this.txFromJSON),
|
|
41
|
+
mint: (this.txFromJSON),
|
|
42
|
+
name: (this.txFromJSON),
|
|
43
|
+
set_admin: (this.txFromJSON),
|
|
44
|
+
admin: (this.txFromJSON),
|
|
45
|
+
set_authorized: (this.txFromJSON),
|
|
46
|
+
symbol: (this.txFromJSON),
|
|
47
|
+
transfer: (this.txFromJSON),
|
|
48
|
+
transfer_from: (this.txFromJSON),
|
|
49
|
+
};
|
|
49
50
|
}
|
|
50
51
|
exports.TokenContract = TokenContract;
|
|
51
52
|
//# sourceMappingURL=token-contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-contract.js","sourceRoot":"","sources":["../../../../../src/services/models/srb/token-contract.ts"],"names":[],"mappings":";;;AAAA,sDAAgD;AAIhD,IAAO,YAAY,GAAG,sBAAQ,CAAC,IAAI,CAAC;AACpC,IAAO,cAAc,GAAG,sBAAQ,CAAC,MAAM,CAAC;AAE3B,QAAA,MAAM,GAAG,EAAE,CAAC;AAyiBzB,4EAA4E;AAC5E,MAAa,aAAc,SAAQ,cAAc;IAC/C,YAA4B,OAA8B;QACxD,KAAK,CACH,IAAI,YAAY,CAAC;YACf,knBAAknB;YAClnB,kQAAkQ;YAClQ,k3CAAk3C;YACl3C,8QAA8Q;YAC9Q,8iBAA8iB;YAC9iB,0kCAA0kC;YAC1kC,8hBAA8hB;YAC9hB,0NAA0N;YAC1N,8ZAA8Z;YAC9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AAA,IAAI,CAAC,UAAkB,CAAA;QAC/B,QAAQ,EAAE,CAAA,IAAI,CAAC,UAAgB,CAAA;QAC/B,aAAa,EAAE,CAAA,IAAI,CAAC,UAAgB,CAAA;KACrC,CAAC;CACH;AA1CD,sCA0CC","sourcesContent":["import { contract } from \"@stellar/stellar-sdk\";\nimport u32 = contract.u32;\nimport i128 = contract.i128;\nimport AssembledTransaction = contract.AssembledTransaction;\nimport ContractSpec = contract.Spec;\nimport ContractClient = contract.Client;\nimport ContractClientOptions = contract.ClientOptions;\nexport const Errors = {};\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport interface TokenContract {\n /**\n * Construct and simulate a allowance transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Returns the allowance for `spender` to transfer from `from`.\n *\n * The amount returned is the amount that spender is allowed to transfer\n * out of from's balance. When the spender transfers amounts, the allowance\n * will be reduced by the amount transfered.\n *\n * # Arguments\n *\n * * `from` - The address holding the balance of tokens to be drawn from.\n * * `spender` - The address spending the tokens held by `from`.\n */\n allowance: (\n { from, spender }: { from: string; spender: string },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<i128>>;\n\n /**\n * Construct and simulate a authorized transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Returns true if `id` is authorized to use its balance.\n *\n * # Arguments\n *\n * * `id` - The address for which token authorization is being checked.\n */\n authorized: (\n { id }: { id: string },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<boolean>>;\n\n /**\n * Construct and simulate a approve transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Set the allowance by `amount` for `spender` to transfer/burn from\n * `from`.\n *\n * The amount set is the amount that spender is approved to transfer out of\n * from's balance. The spender will be allowed to transfer amounts, and\n * when an amount is transferred the allowance will be reduced by the\n * amount transfered.\n *\n * # Arguments\n *\n * * `from` - The address holding the balance of tokens to be drawn from.\n * * `spender` - The address being authorized to spend the tokens held by\n * `from`.\n * * `amount` - The tokens to be made available to `spender`.\n * * `expiration_ledger` - The ledger number where this allowance expires. Cannot\n * be less than the current ledger number unless the amount is being set to 0.\n * An expired entry (where expiration_ledger < the current ledger number)\n * should be treated as a 0 amount allowance.\n *\n * # Events\n *\n * Emits an event with topics `[\"approve\", from: Address,\n * spender: Address], data = [amount: i128, expiration_ledger: u32]`\n */\n approve: (\n {\n from,\n spender,\n amount,\n expiration_ledger,\n }: {\n from: string;\n spender: string;\n amount: i128;\n expiration_ledger: u32;\n },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<null>>;\n\n /**\n * Construct and simulate a balance transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Returns the balance of `id`.\n *\n * # Arguments\n *\n * * `id` - The address for which a balance is being queried. If the\n * address has no existing balance, returns 0.\n */\n balance: (\n { id }: { id: string },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<i128>>;\n\n /**\n * Construct and simulate a burn transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Burn `amount` from `from`.\n *\n * Reduces from's balance by the amount, without transferring the balance\n * to another holder's balance.\n *\n * # Arguments\n *\n * * `from` - The address holding the balance of tokens which will be\n * burned from.\n * * `amount` - The amount of tokens to be burned.\n *\n * # Events\n *\n * Emits an event with topics `[\"burn\", from: Address], data = [amount:\n * i128]`\n */\n burn: (\n { from, amount }: { from: string; amount: i128 },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<null>>;\n\n /**\n * Construct and simulate a burn_from transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Burn `amount` from `from`, consuming the allowance of `spender`.\n *\n * Reduces from's balance by the amount, without transferring the balance\n * to another holder's balance.\n *\n * The spender will be allowed to burn the amount from from's balance, if\n * the amount is less than or equal to the allowance that the spender has\n * on the from's balance. The spender's allowance on from's balance will be\n * reduced by the amount.\n *\n * # Arguments\n *\n * * `spender` - The address authorizing the burn, and having its allowance\n * consumed during the burn.\n * * `from` - The address holding the balance of tokens which will be\n * burned from.\n * * `amount` - The amount of tokens to be burned.\n *\n * # Events\n *\n * Emits an event with topics `[\"burn\", from: Address], data = [amount:\n * i128]`\n */\n burn_from: (\n { spender, from, amount }: { spender: string; from: string; amount: i128 },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<null>>;\n\n /**\n * Construct and simulate a clawback transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Clawback `amount` from `from` account. `amount` is burned in the\n * clawback process.\n *\n * # Arguments\n *\n * * `from` - The address holding the balance from which the clawback will\n * take tokens.\n * * `amount` - The amount of tokens to be clawed back.\n *\n * # Events\n *\n * Emits an event with topics `[\"clawback\", admin: Address, to: Address],\n * data = [amount: i128]`\n */\n clawback: (\n { from, amount }: { from: string; amount: i128 },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<null>>;\n\n /**\n * Construct and simulate a decimals transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Returns the number of decimals used to represent amounts of this token.\n *\n * # Panics\n *\n * If the contract has not yet been initialized.\n */\n decimals: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<u32>>;\n\n /**\n * Construct and simulate a mint transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Mints `amount` to `to`.\n *\n * # Arguments\n *\n * * `to` - The address which will receive the minted tokens.\n * * `amount` - The amount of tokens to be minted.\n *\n * # Events\n *\n * Emits an event with topics `[\"mint\", admin: Address, to: Address], data\n * = [amount: i128]`\n */\n mint: (\n { to, amount }: { to: string; amount: i128 },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<null>>;\n\n /**\n * Construct and simulate a name transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Returns the name for this token.\n *\n * # Panics\n *\n * If the contract has not yet been initialized.\n */\n name: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<string>>;\n\n /**\n * Construct and simulate a set_admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Sets the administrator to the specified address `new_admin`.\n *\n * # Arguments\n *\n * * `new_admin` - The address which will henceforth be the administrator\n * of this token contract.\n *\n * # Events\n *\n * Emits an event with topics `[\"set_admin\", admin: Address], data =\n * [new_admin: Address]`\n */\n set_admin: (\n { new_admin }: { new_admin: string },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<null>>;\n\n /**\n * Construct and simulate a admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Returns the admin of the contract.\n *\n * # Panics\n *\n * If the admin is not set.\n */\n admin: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<string>>;\n\n /**\n * Construct and simulate a set_authorized transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Sets whether the account is authorized to use its balance. If\n * `authorized` is true, `id` should be able to use its balance.\n *\n * # Arguments\n *\n * * `id` - The address being (de-)authorized.\n * * `authorize` - Whether or not `id` can use its balance.\n *\n * # Events\n *\n * Emits an event with topics `[\"set_authorized\", id: Address], data =\n * [authorize: bool]`\n */\n set_authorized: (\n { id, authorize }: { id: string; authorize: boolean },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<null>>;\n\n /**\n * Construct and simulate a symbol transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Returns the symbol for this token.\n *\n * # Panics\n *\n * If the contract has not yet been initialized.\n */\n symbol: (options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n }) => Promise<AssembledTransaction<string>>;\n\n /**\n * Construct and simulate a transfer transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Transfer `amount` from `from` to `to`.\n *\n * # Arguments\n *\n * * `from` - The address holding the balance of tokens which will be\n * withdrawn from.\n * * `to` - The address which will receive the transferred tokens.\n * * `amount` - The amount of tokens to be transferred.\n *\n * # Events\n *\n * Emits an event with topics `[\"transfer\", from: Address, to: Address],\n * data = [amount: i128]`\n */\n transfer: (\n { from, to, amount }: { from: string; to: string; amount: i128 },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<null>>;\n\n /**\n * Construct and simulate a transfer_from transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object. *\n * Transfer `amount` from `from` to `to`, consuming the allowance that\n * `spender` has on `from`'s balance. Authorized by spender\n * (`spender.require_auth()`).\n *\n * The spender will be allowed to transfer the amount from from's balance\n * if the amount is less than or equal to the allowance that the spender\n * has on the from's balance. The spender's allowance on from's balance\n * will be reduced by the amount.\n *\n * # Arguments\n *\n * * `spender` - The address authorizing the transfer, and having its\n * allowance consumed during the transfer.\n * * `from` - The address holding the balance of tokens which will be\n * withdrawn from.\n * * `to` - The address which will receive the transferred tokens.\n * * `amount` - The amount of tokens to be transferred.\n *\n * # Events\n *\n * Emits an event with topics `[\"transfer\", from: Address, to: Address],\n * data = [amount: i128]`\n */\n transfer_from: (\n { spender, from, to, amount }: { spender: string; from: string; to: string; amount: i128 },\n options?: {\n /**\n * The fee to pay for the transaction. Default: BASE_FEE\n */\n fee?: number;\n\n /**\n * The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true\n */\n simulate?: boolean;\n },\n ) => Promise<AssembledTransaction<null>>;\n}\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport class TokenContract extends ContractClient {\n constructor(public readonly options: ContractClientOptions) {\n super(\n new ContractSpec([\n \"AAAAAAAAAYlSZXR1cm5zIHRoZSBhbGxvd2FuY2UgZm9yIGBzcGVuZGVyYCB0byB0cmFuc2ZlciBmcm9tIGBmcm9tYC4KClRoZSBhbW91bnQgcmV0dXJuZWQgaXMgdGhlIGFtb3VudCB0aGF0IHNwZW5kZXIgaXMgYWxsb3dlZCB0byB0cmFuc2ZlcgpvdXQgb2YgZnJvbSdzIGJhbGFuY2UuIFdoZW4gdGhlIHNwZW5kZXIgdHJhbnNmZXJzIGFtb3VudHMsIHRoZSBhbGxvd2FuY2UKd2lsbCBiZSByZWR1Y2VkIGJ5IHRoZSBhbW91bnQgdHJhbnNmZXJlZC4KCiMgQXJndW1lbnRzCgoqIGBmcm9tYCAtIFRoZSBhZGRyZXNzIGhvbGRpbmcgdGhlIGJhbGFuY2Ugb2YgdG9rZW5zIHRvIGJlIGRyYXduIGZyb20uCiogYHNwZW5kZXJgIC0gVGhlIGFkZHJlc3Mgc3BlbmRpbmcgdGhlIHRva2VucyBoZWxkIGJ5IGBm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lsbCBiZSByZWR1Y2VkIGJ5IHRoZSBhbW91bnQuCgojIEFyZ3VtZW50cwoKKiBgc3BlbmRlcmAgLSBUaGUgYWRkcmVzcyBhdXRob3JpemluZyB0aGUgdHJhbnNmZXIsIGFuZCBoYXZpbmcgaXRzCmFsbG93YW5jZSBjb25zdW1lZCBkdXJpbmcgdGhlIHRyYW5zZmVyLgoqIGBmcm9tYCAtIFRoZSBhZGRyZXNzIGhvbGRpbmcgdGhlIGJhbGFuY2Ugb2YgdG9rZW5zIHdoaWNoIHdpbGwgYmUKd2l0aGRyYXduIGZyb20uCiogYHRvYCAtIFRoZSBhZGRyZXNzIHdoaWNoIHdpbGwgcmVjZWl2ZSB0aGUgdHJhbnNmZXJyZWQgdG9rZW5zLgoqIGBhbW91bnRgIC0gVGhlIGFtb3VudCBvZiB0b2tlbnMgdG8gYmUgdHJhbnNmZXJyZWQuCgojIEV2ZW50cwoKRW1pdHMgYW4gZXZlbnQgd2l0aCB0b3BpY3MgYFsidHJhbnNmZXIiLCBmcm9tOiBBZGRyZXNzLCB0bzogQWRkcmVzc10sCmRhdGEgPSBbYW1vdW50OiBpMTI4XWAAAAAADXRyYW5zZmVyX2Zyb20AAAAAAAAEAAAAAAAAAAdzcGVuZGVyAAAAABMAAAAAAAAABGZyb20AAAATAAAAAAAAAAJ0bwAAAAAAEwAAAAAAAAAGYW1vdW50AAAAAAALAAAAAA==\",\n ]),\n options,\n );\n }\n public readonly fromJSON = {\n allowance: this.txFromJSON<i128>,\n authorized: this.txFromJSON<boolean>,\n approve: this.txFromJSON<null>,\n balance: this.txFromJSON<i128>,\n burn: this.txFromJSON<null>,\n burn_from: this.txFromJSON<null>,\n clawback: this.txFromJSON<null>,\n decimals: this.txFromJSON<u32>,\n mint: this.txFromJSON<null>,\n name: this.txFromJSON<string>,\n set_admin: this.txFromJSON<null>,\n admin: this.txFromJSON<string>,\n set_authorized: this.txFromJSON<null>,\n symbol: this.txFromJSON<string>,\n transfer: this.txFromJSON<null>,\n transfer_from: this.txFromJSON<null>,\n };\n}\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getViewResultSoroban = getViewResultSoroban;
|
|
4
|
+
exports.isErrorSorobanResult = isErrorSorobanResult;
|
|
5
|
+
exports.signAndSendSoroban = signAndSendSoroban;
|
|
4
6
|
const stellar_sdk_1 = require("@stellar/stellar-sdk");
|
|
5
7
|
var Api = stellar_sdk_1.rpc.Api;
|
|
6
8
|
function getViewResultSoroban(assembledTx) {
|
|
@@ -18,7 +20,6 @@ function getViewResultSoroban(assembledTx) {
|
|
|
18
20
|
throw new Error(simulation.error);
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
|
-
exports.getViewResultSoroban = getViewResultSoroban;
|
|
22
23
|
function isErrorSorobanResult(assembledTx) {
|
|
23
24
|
const { simulation } = assembledTx;
|
|
24
25
|
if (!simulation) {
|
|
@@ -26,10 +27,8 @@ function isErrorSorobanResult(assembledTx) {
|
|
|
26
27
|
}
|
|
27
28
|
return Api.isSimulationError(simulation);
|
|
28
29
|
}
|
|
29
|
-
exports.isErrorSorobanResult = isErrorSorobanResult;
|
|
30
30
|
async function signAndSendSoroban(assembledTx) {
|
|
31
31
|
await assembledTx.simulate({ restore: true });
|
|
32
32
|
return assembledTx.signAndSend();
|
|
33
33
|
}
|
|
34
|
-
exports.signAndSendSoroban = signAndSendSoroban;
|
|
35
34
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/services/models/srb/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/services/models/srb/utils.ts"],"names":[],"mappings":";;AAKA,oDAcC;AAED,oDAMC;AAED,gDAGC;AAhCD,sDAAqD;AACrD,IAAO,GAAG,GAAG,iBAAG,CAAC,GAAG,CAAC;AAIrB,SAAgB,oBAAoB,CAAI,WAAoC;IAC1E,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;IAC5C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IAED,IAAI,GAAG,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,CAAC;QACxC,IAAI,UAAU,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;YAC9B,OAAO;QACT,CAAC;QACD,OAAO,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1D,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;AACH,CAAC;AAED,SAAgB,oBAAoB,CAAI,WAAoC;IAC1E,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;IACnC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,GAAG,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC;AAEM,KAAK,UAAU,kBAAkB,CAAI,WAAoC;IAC9E,MAAM,WAAW,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,OAAO,WAAW,CAAC,WAAW,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import { contract, rpc } from \"@stellar/stellar-sdk\";\nimport Api = rpc.Api;\nimport AssembledTransaction = contract.AssembledTransaction;\nimport SentTransaction = contract.SentTransaction;\n\nexport function getViewResultSoroban<T>(assembledTx: AssembledTransaction<T>): T | undefined {\n const { simulation, options } = assembledTx;\n if (!simulation) {\n throw new Error(\"Soroban assembled transaction does not have simulation\");\n }\n\n if (Api.isSimulationSuccess(simulation)) {\n if (simulation.result == null) {\n return;\n }\n return options.parseResultXdr(simulation.result.retval);\n } else {\n throw new Error(simulation.error);\n }\n}\n\nexport function isErrorSorobanResult<T>(assembledTx: AssembledTransaction<T>): boolean {\n const { simulation } = assembledTx;\n if (!simulation) {\n throw new Error(\"Soroban assembled transaction does not have simulation\");\n }\n return Api.isSimulationError(simulation);\n}\n\nexport async function signAndSendSoroban<T>(assembledTx: AssembledTransaction<T>): Promise<SentTransaction<T>> {\n await assembledTx.simulate({ restore: true });\n return assembledTx.signAndSend();\n}\n"]}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import Web3 from "web3";
|
|
2
1
|
import { ChainType } from "../../../chains/chain.enums";
|
|
3
2
|
import { AllbridgeCoreClient } from "../../../client/core-api/core-client-base";
|
|
4
|
-
import { GetTokenBalanceParams, TransactionResponse } from "../../../models";
|
|
3
|
+
import { GetTokenBalanceParams, EssentialWeb3, TransactionResponse } from "../../../models";
|
|
5
4
|
import { GetNativeTokenBalanceParams } from "../../bridge/models";
|
|
6
5
|
import { RawTransaction } from "../../models";
|
|
7
|
-
import { ApproveParamsDto, GetAllowanceParamsDto } from "../models";
|
|
8
|
-
import { ChainTokenService } from "../models/token";
|
|
6
|
+
import { ApproveParamsDto, GetAllowanceParamsDto, ChainTokenService } from "../models";
|
|
9
7
|
export declare const MAX_AMOUNT = "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
|
|
10
8
|
export declare class EvmTokenService extends ChainTokenService {
|
|
11
|
-
web3:
|
|
9
|
+
web3: EssentialWeb3;
|
|
12
10
|
api: AllbridgeCoreClient;
|
|
13
11
|
chainType: ChainType.EVM;
|
|
14
|
-
constructor(web3:
|
|
12
|
+
constructor(web3: EssentialWeb3, api: AllbridgeCoreClient);
|
|
15
13
|
getAllowance(params: GetAllowanceParamsDto): Promise<string>;
|
|
16
14
|
getAllowanceByTokenAddress(tokenAddress: string, owner: string, spender: string): Promise<string>;
|
|
17
15
|
getTokenBalance(params: GetTokenBalanceParams): Promise<string>;
|
|
@@ -20,5 +18,5 @@ export declare class EvmTokenService extends ChainTokenService {
|
|
|
20
18
|
isUsdt(tokenAddress: string): boolean;
|
|
21
19
|
buildRawTransactionApprove(params: ApproveParamsDto): Promise<RawTransaction>;
|
|
22
20
|
private sendRawTransaction;
|
|
23
|
-
private
|
|
21
|
+
private getERC20Contract;
|
|
24
22
|
}
|
|
@@ -4,19 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.EvmTokenService = exports.MAX_AMOUNT = void 0;
|
|
7
|
-
const erc_20_abi_1 = __importDefault(require("erc-20-abi"));
|
|
8
7
|
const chain_enums_1 = require("../../../chains/chain.enums");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const ERC20_1 = __importDefault(require("../../models/abi/ERC20"));
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const models_1 = require("../models");
|
|
11
11
|
exports.MAX_AMOUNT = "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
|
|
12
12
|
const USDT_TOKEN_ADDRESS = "0xdac17f958d2ee523a2206206994597c13d831ec7";
|
|
13
|
-
const POLYGON_GAS_LIMIT =
|
|
14
|
-
class EvmTokenService extends
|
|
13
|
+
const POLYGON_GAS_LIMIT = 100_000;
|
|
14
|
+
class EvmTokenService extends models_1.ChainTokenService {
|
|
15
|
+
web3;
|
|
16
|
+
api;
|
|
17
|
+
chainType = chain_enums_1.ChainType.EVM;
|
|
15
18
|
constructor(web3, api) {
|
|
16
19
|
super();
|
|
17
20
|
this.web3 = web3;
|
|
18
21
|
this.api = api;
|
|
19
|
-
this.chainType = chain_enums_1.ChainType.EVM;
|
|
20
22
|
}
|
|
21
23
|
getAllowance(params) {
|
|
22
24
|
const tokenAddress = params.token.tokenAddress;
|
|
@@ -25,16 +27,14 @@ class EvmTokenService extends token_1.ChainTokenService {
|
|
|
25
27
|
return this.getAllowanceByTokenAddress(tokenAddress, owner, spender);
|
|
26
28
|
}
|
|
27
29
|
getAllowanceByTokenAddress(tokenAddress, owner, spender) {
|
|
28
|
-
const tokenContract = this.
|
|
30
|
+
const tokenContract = this.getERC20Contract(tokenAddress);
|
|
29
31
|
return tokenContract.methods.allowance(owner, spender).call();
|
|
30
32
|
}
|
|
31
33
|
async getTokenBalance(params) {
|
|
32
|
-
return await this.
|
|
33
|
-
.methods.balanceOf(params.account)
|
|
34
|
-
.call();
|
|
34
|
+
return await this.getERC20Contract(params.token.tokenAddress).methods.balanceOf(params.account).call();
|
|
35
35
|
}
|
|
36
36
|
async getNativeTokenBalance(params) {
|
|
37
|
-
return await this.web3.eth.getBalance(params.account);
|
|
37
|
+
return (await this.web3.eth.getBalance(params.account)).toString();
|
|
38
38
|
}
|
|
39
39
|
async approve(params) {
|
|
40
40
|
if (this.isUsdt(params.tokenAddress)) {
|
|
@@ -53,34 +53,35 @@ class EvmTokenService extends token_1.ChainTokenService {
|
|
|
53
53
|
isUsdt(tokenAddress) {
|
|
54
54
|
return tokenAddress.toLowerCase() === USDT_TOKEN_ADDRESS;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
buildRawTransactionApprove(params) {
|
|
57
57
|
const { tokenAddress, spender, owner, amount } = params;
|
|
58
|
-
const tokenContract = this.
|
|
59
|
-
const approveMethod =
|
|
60
|
-
return {
|
|
58
|
+
const tokenContract = this.getERC20Contract(tokenAddress);
|
|
59
|
+
const approveMethod = tokenContract.methods.approve(spender, amount == undefined ? exports.MAX_AMOUNT : (0, utils_1.amountToHex)(amount));
|
|
60
|
+
return Promise.resolve({
|
|
61
61
|
from: owner,
|
|
62
62
|
to: tokenAddress,
|
|
63
63
|
value: "0",
|
|
64
64
|
data: approveMethod.encodeABI(),
|
|
65
|
-
};
|
|
65
|
+
});
|
|
66
66
|
}
|
|
67
67
|
async sendRawTransaction(rawTransaction, chainSymbol) {
|
|
68
68
|
const transactionConfig = rawTransaction;
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
70
|
-
// @ts-expect-error DISABLE SITE SUGGESTED GAS FEE IN METAMASK
|
|
71
69
|
// prettier-ignore
|
|
72
|
-
const feeOptions = { maxPriorityFeePerGas:
|
|
70
|
+
const feeOptions = { maxPriorityFeePerGas: undefined, maxFeePerGas: undefined };
|
|
73
71
|
if (chainSymbol === chain_enums_1.ChainSymbol.POL) {
|
|
74
72
|
transactionConfig.gas = POLYGON_GAS_LIMIT;
|
|
75
73
|
}
|
|
76
74
|
else {
|
|
77
75
|
transactionConfig.gas = await this.web3.eth.estimateGas(rawTransaction);
|
|
78
76
|
}
|
|
79
|
-
const { transactionHash } = await this.web3.eth.sendTransaction({
|
|
80
|
-
|
|
77
|
+
const { transactionHash } = await this.web3.eth.sendTransaction({
|
|
78
|
+
...transactionConfig,
|
|
79
|
+
...feeOptions,
|
|
80
|
+
});
|
|
81
|
+
return { txId: transactionHash.toString() };
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
-
return new this.web3.eth.Contract(
|
|
83
|
+
getERC20Contract(contractAddress) {
|
|
84
|
+
return new this.web3.eth.Contract(ERC20_1.default.abi, contractAddress);
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
exports.EvmTokenService = EvmTokenService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/token/evm/index.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/token/evm/index.ts"],"names":[],"mappings":";;;;;;AAEA,6DAAqE;AAKrE,mEAA2C;AAC3C,uCAA0C;AAC1C,sCAAuF;AAE1E,QAAA,UAAU,GAAG,oEAAoE,CAAC;AAE/F,MAAM,kBAAkB,GAAG,4CAA4C,CAAC;AACxE,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC,MAAa,eAAgB,SAAQ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AAM,iBAAiB,GAAoB,cAAiC,CAAC;QAC7E,kBAAkB;QAClB,MAAM,UAAU,GAGZ,EAAC,oBAAoB,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAC,CAAC;QAC/D,IAAK,WAA2B,KAAK,yBAAW,CAAC,GAAG,EAAE,CAAC;YACrD,iBAAiB,CAAC,GAAG,GAAG,iBAAiB,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,iBAAiB,CAAC,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,cAAiC,CAAC,CAAC;QAC7F,CAAC;QACD,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC;YAC9D,GAAG,iBAAiB;YACpB,GAAG,UAAU;SACK,CAAC,CAAC;QACtB,OAAO,EAAE,IAAI,EAAE,eAAe,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC9C,CAAC;IAEO,gBAAgB,CAAC,eAAuB;QAC9C,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAK,CAAC,GAAG,EAAE,eAAe,CAA+B,CAAC;IAC9F,CAAC;CACF;AAxFD,0CAwFC","sourcesContent":["import BN from \"bn.js\";\nimport { Contract, Transaction as Web3Transaction } from \"web3\";\nimport { ChainSymbol, ChainType } from \"../../../chains/chain.enums\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { GetTokenBalanceParams, EssentialWeb3, TransactionResponse } from \"../../../models\";\nimport { GetNativeTokenBalanceParams } from \"../../bridge/models\";\nimport { RawTransaction } from \"../../models\";\nimport ERC20 from \"../../models/abi/ERC20\";\nimport { amountToHex } from \"../../utils\";\nimport { ApproveParamsDto, GetAllowanceParamsDto, ChainTokenService } from \"../models\";\n\nexport const MAX_AMOUNT = \"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\";\n\nconst USDT_TOKEN_ADDRESS = \"0xdac17f958d2ee523a2206206994597c13d831ec7\";\nconst POLYGON_GAS_LIMIT = 100_000;\n\nexport class EvmTokenService extends ChainTokenService {\n chainType: ChainType.EVM = ChainType.EVM;\n\n constructor(\n public web3: EssentialWeb3,\n public api: AllbridgeCoreClient,\n ) {\n super();\n }\n\n getAllowance(params: GetAllowanceParamsDto): Promise<string> {\n const tokenAddress = params.token.tokenAddress;\n const owner = params.owner;\n const spender = params.spender;\n return this.getAllowanceByTokenAddress(tokenAddress, owner, spender);\n }\n\n getAllowanceByTokenAddress(tokenAddress: string, owner: string, spender: string): Promise<string> {\n const tokenContract = this.getERC20Contract(tokenAddress);\n return tokenContract.methods.allowance(owner, spender).call();\n }\n\n async getTokenBalance(params: GetTokenBalanceParams): Promise<string> {\n return await this.getERC20Contract(params.token.tokenAddress).methods.balanceOf(params.account).call();\n }\n\n async getNativeTokenBalance(params: GetNativeTokenBalanceParams): Promise<string> {\n return (await this.web3.eth.getBalance(params.account)).toString();\n }\n\n async approve(params: ApproveParamsDto): Promise<TransactionResponse> {\n if (this.isUsdt(params.tokenAddress)) {\n const allowance = await this.getAllowanceByTokenAddress(params.tokenAddress, params.owner, params.spender);\n if (allowance !== \"0\") {\n const rawTransaction = await this.buildRawTransactionApprove({\n ...params,\n amount: \"0\",\n });\n await this.sendRawTransaction(rawTransaction, params.chainSymbol);\n }\n }\n const rawTransaction = await this.buildRawTransactionApprove(params);\n return await this.sendRawTransaction(rawTransaction, params.chainSymbol);\n }\n\n isUsdt(tokenAddress: string): boolean {\n return tokenAddress.toLowerCase() === USDT_TOKEN_ADDRESS;\n }\n\n buildRawTransactionApprove(params: ApproveParamsDto): Promise<RawTransaction> {\n const { tokenAddress, spender, owner, amount } = params;\n const tokenContract = this.getERC20Contract(tokenAddress);\n\n const approveMethod = tokenContract.methods.approve(\n spender,\n amount == undefined ? MAX_AMOUNT : amountToHex(amount),\n );\n\n return Promise.resolve({\n from: owner,\n to: tokenAddress,\n value: \"0\",\n data: approveMethod.encodeABI(),\n });\n }\n\n private async sendRawTransaction(rawTransaction: RawTransaction, chainSymbol: string) {\n const transactionConfig: Web3Transaction = rawTransaction as Web3Transaction;\n // prettier-ignore\n const feeOptions: {\n maxPriorityFeePerGas?: number | string | BN;\n maxFeePerGas?: number | string | BN\n } = {maxPriorityFeePerGas: undefined, maxFeePerGas: undefined};\n if ((chainSymbol as ChainSymbol) === ChainSymbol.POL) {\n transactionConfig.gas = POLYGON_GAS_LIMIT;\n } else {\n transactionConfig.gas = await this.web3.eth.estimateGas(rawTransaction as Web3Transaction);\n }\n const { transactionHash } = await this.web3.eth.sendTransaction({\n ...transactionConfig,\n ...feeOptions,\n } as Web3Transaction);\n return { txId: transactionHash.toString() };\n }\n\n private getERC20Contract(contractAddress: string) {\n return new this.web3.eth.Contract(ERC20.abi, contractAddress) as Contract<typeof ERC20.abi>;\n }\n}\n"]}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.DefaultTokenService = void 0;
|
|
7
4
|
const big_js_1 = require("big.js");
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const web3_1 = __importDefault(require("web3"));
|
|
5
|
+
const tronweb_1 = require("tronweb");
|
|
6
|
+
const web3_1 = require("web3");
|
|
11
7
|
const chains_1 = require("../../chains");
|
|
12
8
|
const index_1 = require("../../index");
|
|
13
9
|
const models_1 = require("../../models");
|
|
@@ -18,6 +14,9 @@ const sol_1 = require("./sol");
|
|
|
18
14
|
const srb_1 = require("./srb");
|
|
19
15
|
const trx_1 = require("./trx");
|
|
20
16
|
class DefaultTokenService {
|
|
17
|
+
api;
|
|
18
|
+
nodeRpcUrlsConfig;
|
|
19
|
+
params;
|
|
21
20
|
constructor(api, nodeRpcUrlsConfig, params) {
|
|
22
21
|
this.api = api;
|
|
23
22
|
this.nodeRpcUrlsConfig = nodeRpcUrlsConfig;
|
|
@@ -68,7 +67,7 @@ class DefaultTokenService {
|
|
|
68
67
|
}
|
|
69
68
|
else {
|
|
70
69
|
const nodeRpcUrl = this.nodeRpcUrlsConfig.getNodeRpcUrl(chainSymbol);
|
|
71
|
-
return new evm_1.EvmTokenService(new web3_1.
|
|
70
|
+
return new evm_1.EvmTokenService(new web3_1.Web3(nodeRpcUrl), this.api);
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
case index_1.ChainType.TRX: {
|
|
@@ -77,7 +76,7 @@ class DefaultTokenService {
|
|
|
77
76
|
}
|
|
78
77
|
else {
|
|
79
78
|
const nodeRpcUrl = this.nodeRpcUrlsConfig.getNodeRpcUrl(chainSymbol);
|
|
80
|
-
const tronWeb = new tronweb_1.
|
|
79
|
+
const tronWeb = new tronweb_1.TronWeb({ fullHost: nodeRpcUrl });
|
|
81
80
|
tronWeb.setAddress(ownerAddress);
|
|
82
81
|
return new trx_1.TronTokenService(tronWeb, this.api);
|
|
83
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/token/index.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA6B;AAC7B,+BAA+B;AAC/B,sDAA8B;AAC9B,gDAAwB;AACxB,yCAAsC;AAEtC,uCAAiE;AACjE,yCAA6D;AAC7D,yDAA2F;AAC3F,6CAAiF;AAIjF,+BAAwC;AAUxC,+BAA2C;AAC3C,+BAAwC;AACxC,+BAAyC;AAgBzC,MAAa,mBAAmB;IAC9B,YACW,GAAwB,EACxB,iBAAoC,EACpC,MAA+B;QAF/B,QAAG,GAAH,GAAG,CAAqB;QACxB,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,WAAM,GAAN,MAAM,CAAyB;IACvC,CAAC;IAEJ,KAAK,CAAC,YAAY,CAAC,MAA0B,EAAE,QAAmB;Q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E,IAAI,CAAC,GAAG,CAAC,CAAC;YACtD,CAAC;YACD,KAAK,iBAAS,CAAC,GAAG,CAAC,CAAC,CAAC;gBACnB,OAAO,IAAI,qBAAe,CAAC,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;IACH,CAAC;IAED,2BAA2B,CAAC,MAA4B;QACtD,OAAO;YACL,GAAG,MAAM;YACT,MAAM,EAAE,IAAA,qCAAuB,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;SACtE,CAAC;IACJ,CAAC;IAEO,oBAAoB,CAAC,WAA0B;QACrD,OAAO;YACL,YAAY,EAAE,WAAW,CAAC,KAAK,CAAC,YAAY;YAC5C,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,WAAW;YAC1C,MAAM,EAAE,WAAW,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,YAAG,EAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE;SACxF,CAAC;IACJ,CAAC;CACF;AArHD,kDAqHC","sourcesContent":["import { Big } from \"big.js\";\nimport { TronWeb } from \"tronweb\";\nimport { Web3 } from \"web3\";\nimport { Chains } from \"../../chains\";\nimport { AllbridgeCoreClient } from \"../../client/core-api/core-client-base\";\nimport { AllbridgeCoreSdkOptions, ChainType, EssentialWeb3 } from \"../../index\";\nimport { AmountFormat, AmountFormatted } from \"../../models\";\nimport { convertFloatAmountToInt, convertIntAmountToFloat } from \"../../utils/calculation\";\nimport { validateAmountDecimals, validateAmountGtZero } from \"../../utils/utils\";\nimport { GetNativeTokenBalanceParams } from \"../bridge/models\";\nimport { NodeRpcUrlsConfig } from \"../index\";\nimport { Provider, RawTransaction, TransactionResponse } from \"../models\";\nimport { EvmTokenService } from \"./evm\";\nimport {\n ApproveParams,\n ApproveParamsDto,\n CheckAllowanceParams,\n CheckAllowanceParamsDto,\n GetAllowanceParams,\n GetTokenBalanceParams,\n ChainTokenService,\n} from \"./models\";\nimport { SolanaTokenService } from \"./sol\";\nimport { SrbTokenService } from \"./srb\";\nimport { TronTokenService } from \"./trx\";\n\nexport interface TokenService {\n getAllowance(params: GetAllowanceParams, provider?: Provider): Promise<string>;\n\n checkAllowance(params: CheckAllowanceParams, provider?: Provider): Promise<boolean>;\n\n approve(provider: Provider, approveData: ApproveParams): Promise<TransactionResponse>;\n\n buildRawTransactionApprove(approveData: ApproveParams, provider?: Provider): Promise<RawTransaction>;\n\n getTokenBalance(params: GetTokenBalanceParams, provider?: Provider): Promise<string>;\n\n getNativeTokenBalance(params: GetNativeTokenBalanceParams, provider?: Provider): Promise<AmountFormatted>;\n}\n\nexport class DefaultTokenService implements TokenService {\n constructor(\n readonly api: AllbridgeCoreClient,\n readonly nodeRpcUrlsConfig: NodeRpcUrlsConfig,\n readonly params: AllbridgeCoreSdkOptions,\n ) {}\n\n async getAllowance(params: GetAllowanceParams, provider?: Provider): Promise<string> {\n const allowanceInt = await this.getChainTokenService(params.token.chainSymbol, params.owner, provider).getAllowance(\n params,\n );\n return convertIntAmountToFloat(allowanceInt, params.token.decimals).toFixed();\n }\n\n async checkAllowance(params: CheckAllowanceParams, provider?: Provider): Promise<boolean> {\n validateAmountGtZero(params.amount);\n validateAmountDecimals(\"amount\", params.amount, params.token.decimals);\n return this.getChainTokenService(params.token.chainSymbol, params.owner, provider).checkAllowance(\n this.prepareCheckAllowanceParams(params),\n );\n }\n\n async approve(provider: Provider, approveData: ApproveParams): Promise<TransactionResponse> {\n if (approveData.amount) {\n validateAmountGtZero(approveData.amount);\n validateAmountDecimals(\"amount\", approveData.amount, approveData.token.decimals);\n }\n return this.getChainTokenService(approveData.token.chainSymbol, approveData.owner, provider).approve(\n this.prepareApproveParams(approveData),\n );\n }\n\n async buildRawTransactionApprove(approveData: ApproveParams, provider?: Provider): Promise<RawTransaction> {\n if (approveData.amount) {\n validateAmountGtZero(approveData.amount);\n validateAmountDecimals(\"amount\", approveData.amount, approveData.token.decimals);\n }\n return this.getChainTokenService(\n approveData.token.chainSymbol,\n approveData.owner,\n provider,\n ).buildRawTransactionApprove(this.prepareApproveParams(approveData));\n }\n\n async getTokenBalance(params: GetTokenBalanceParams, provider?: Provider): Promise<string> {\n const tokenBalance = await this.getChainTokenService(\n params.token.chainSymbol,\n params.account,\n provider,\n ).getTokenBalance(params);\n if (params.token.decimals) {\n return convertIntAmountToFloat(tokenBalance, params.token.decimals).toFixed();\n }\n return tokenBalance;\n }\n\n async getNativeTokenBalance(params: GetNativeTokenBalanceParams, provider?: Provider): Promise<AmountFormatted> {\n const tokenBalance = await this.getChainTokenService(\n params.chainSymbol,\n params.account,\n provider,\n ).getNativeTokenBalance(params);\n return {\n [AmountFormat.INT]: tokenBalance,\n [AmountFormat.FLOAT]: convertIntAmountToFloat(\n tokenBalance,\n Chains.getChainDecimalsByType(Chains.getChainProperty(params.chainSymbol).chainType),\n ).toFixed(),\n };\n }\n\n private getChainTokenService(chainSymbol: string, ownerAddress: string, provider?: Provider): ChainTokenService {\n switch (Chains.getChainProperty(chainSymbol).chainType) {\n case ChainType.EVM: {\n if (provider) {\n return new EvmTokenService(provider as EssentialWeb3, this.api);\n } else {\n const nodeRpcUrl = this.nodeRpcUrlsConfig.getNodeRpcUrl(chainSymbol);\n return new EvmTokenService(new Web3(nodeRpcUrl), this.api);\n }\n }\n case ChainType.TRX: {\n if (provider) {\n return new TronTokenService(provider as TronWeb, this.api);\n } else {\n const nodeRpcUrl = this.nodeRpcUrlsConfig.getNodeRpcUrl(chainSymbol);\n const tronWeb = new TronWeb({ fullHost: nodeRpcUrl });\n tronWeb.setAddress(ownerAddress);\n return new TronTokenService(tronWeb, this.api);\n }\n }\n case ChainType.SOLANA: {\n const nodeRpcUrl = this.nodeRpcUrlsConfig.getNodeRpcUrl(chainSymbol);\n return new SolanaTokenService(nodeRpcUrl, this.api);\n }\n case ChainType.SRB: {\n return new SrbTokenService(this.nodeRpcUrlsConfig, this.params, this.api);\n }\n }\n }\n\n prepareCheckAllowanceParams(params: CheckAllowanceParams): CheckAllowanceParamsDto {\n return {\n ...params,\n amount: convertFloatAmountToInt(params.amount, params.token.decimals),\n };\n }\n\n private prepareApproveParams(approveData: ApproveParams): ApproveParamsDto {\n return {\n tokenAddress: approveData.token.tokenAddress,\n owner: approveData.owner,\n spender: approveData.spender,\n chainSymbol: approveData.token.chainSymbol,\n amount: approveData.amount == undefined ? undefined : Big(approveData.amount).toFixed(),\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/token/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,iCAA4C;AAAnC,0GAAA,iBAAiB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/token/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,iCAA4C;AAAnC,0GAAA,iBAAiB,OAAA","sourcesContent":["export * from \"./token.model\";\nexport { ChainTokenService } from \"./token\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../../../src/services/token/models/token.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;AAO7B,MAAsB,iBAAiB;IAUrC,KAAK,CAAC,cAAc,CAAC,MAA+B;QAClD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAClD,OAAO,IAAA,YAAG,EAAC,SAAS,CAAC,CAAC,GAAG,CAAC,IAAA,YAAG,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC;CAKF;AAlBD,8CAkBC"}
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../../../src/services/token/models/token.ts"],"names":[],"mappings":";;;AAAA,mCAA6B;AAO7B,MAAsB,iBAAiB;IAUrC,KAAK,CAAC,cAAc,CAAC,MAA+B;QAClD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAClD,OAAO,IAAA,YAAG,EAAC,SAAS,CAAC,CAAC,GAAG,CAAC,IAAA,YAAG,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC;CAKF;AAlBD,8CAkBC","sourcesContent":["import { Big } from \"big.js\";\nimport { ChainType } from \"../../../chains/chain.enums\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { GetNativeTokenBalanceParams } from \"../../bridge/models\";\nimport { RawTransaction, TransactionResponse } from \"../../models\";\nimport { ApproveParamsDto, CheckAllowanceParamsDto, GetAllowanceParamsDto, GetTokenBalanceParams } from \"./token.model\";\n\nexport abstract class ChainTokenService {\n abstract chainType: ChainType;\n abstract api: AllbridgeCoreClient;\n\n abstract getTokenBalance(params: GetTokenBalanceParams): Promise<string>;\n\n abstract getNativeTokenBalance(params: GetNativeTokenBalanceParams): Promise<string>;\n\n abstract getAllowance(params: GetAllowanceParamsDto): Promise<string>;\n\n async checkAllowance(params: CheckAllowanceParamsDto): Promise<boolean> {\n const allowance = await this.getAllowance(params);\n return Big(allowance).gte(Big(params.amount));\n }\n\n abstract approve(params: ApproveParamsDto): Promise<TransactionResponse>;\n\n abstract buildRawTransactionApprove(params: ApproveParamsDto): Promise<RawTransaction>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.model.js","sourceRoot":"","sources":["../../../../../src/services/token/models/token.model.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"token.model.js","sourceRoot":"","sources":["../../../../../src/services/token/models/token.model.ts"],"names":[],"mappings":"","sourcesContent":["import { Big } from \"big.js\";\nimport { FeePaymentMethod } from \"../../../models\";\nimport { TokenWithChainDetails } from \"../../../tokens-info\";\n\nexport interface ApproveParams {\n /**\n * The token info\n */\n token: TokenWithChainDetails;\n\n /**\n * The address of the token owner who is granting permission to use tokens\n * to the spender\n */\n owner: string;\n\n /**\n * The address of the contract that is being granted permission to use tokens\n */\n spender: string;\n\n /**\n * The integer amount of tokens to approve.\n * Optional.\n * The maximum amount by default.\n */\n amount?: string | number | Big;\n}\n\nexport interface GetTokenBalanceParams {\n /**\n * The address for which we will find out the token balance\n */\n account: string;\n token: TokenWithChainDetails;\n}\n\nexport interface CheckAllowanceParams extends GetAllowanceParams {\n /**\n * The float amount of tokens to check the allowance.\n */\n amount: string | number | Big;\n}\n\nexport interface GetAllowanceParams {\n token: TokenWithChainDetails;\n spender: string;\n owner: string;\n gasFeePaymentMethod?: FeePaymentMethod;\n}\n\nexport interface ApproveParamsDto {\n tokenAddress: string;\n chainSymbol: string;\n owner: string;\n spender: string;\n /**\n * Integer amount of tokens to approve.\n */\n amount?: string;\n}\n\nexport type GetAllowanceParamsDto = GetAllowanceParams;\n\n/**\n * @internal\n */\nexport interface CheckAllowanceParamsDto extends GetAllowanceParamsDto {\n /**\n * The integer amount of tokens to check the allowance.\n */\n amount: string | number | Big;\n}\n"]}
|