@allbridge/bridge-core-sdk 3.22.1-alpha.2 → 3.23.0-beta.2
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/README.md +8 -8
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/cjs/index.js +1 -5
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +4 -4
- package/dist/src/chains/chain.enums.d.ts +5 -1
- package/dist/src/chains/chain.enums.js +4 -0
- package/dist/src/chains/chain.enums.js.map +1 -1
- package/dist/src/chains/index.js +6 -0
- package/dist/src/chains/index.js.map +1 -1
- package/dist/src/client/core-api/api-client-caching.js +1 -1
- package/dist/src/client/core-api/api-client-caching.js.map +1 -1
- package/dist/src/client/core-api/api-client.js +6 -0
- package/dist/src/client/core-api/api-client.js.map +1 -1
- package/dist/src/client/core-api/core-api-mapper.js +3 -0
- package/dist/src/client/core-api/core-api-mapper.js.map +1 -1
- package/dist/src/client/core-api/core-api.model.d.ts +8 -2
- package/dist/src/client/core-api/core-api.model.js +2 -0
- package/dist/src/client/core-api/core-api.model.js.map +1 -1
- package/dist/src/exceptions/exceptions.d.ts +4 -0
- package/dist/src/exceptions/exceptions.js +8 -1
- package/dist/src/exceptions/exceptions.js.map +1 -1
- package/dist/src/index.d.ts +10 -17
- package/dist/src/index.js +34 -26
- package/dist/src/index.js.map +1 -1
- package/dist/src/models/index.d.ts +1 -0
- package/dist/src/models/index.js.map +1 -1
- package/dist/src/services/bridge/evm/index.d.ts +3 -1
- package/dist/src/services/bridge/evm/index.js +47 -15
- package/dist/src/services/bridge/evm/index.js.map +1 -1
- package/dist/src/services/bridge/get-cctp-sol-token-recipient-address.js +3 -3
- package/dist/src/services/bridge/get-cctp-sol-token-recipient-address.js.map +1 -1
- package/dist/src/services/bridge/index.d.ts +1 -1
- package/dist/src/services/bridge/index.js +30 -26
- package/dist/src/services/bridge/index.js.map +1 -1
- package/dist/src/services/bridge/models/bridge.model.d.ts +4 -0
- package/dist/src/services/bridge/models/bridge.model.js.map +1 -1
- package/dist/src/services/bridge/raw-bridge-transaction-builder.js +2 -2
- 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 +8 -5
- package/dist/src/services/bridge/sol/index.js.map +1 -1
- package/dist/src/services/bridge/srb/index.js +1 -1
- package/dist/src/services/bridge/srb/index.js.map +1 -1
- package/dist/src/services/bridge/sui/index.js +3 -1
- package/dist/src/services/bridge/sui/index.js.map +1 -1
- package/dist/src/services/bridge/trx/index.d.ts +1 -1
- package/dist/src/services/bridge/trx/index.js +85 -54
- package/dist/src/services/bridge/trx/index.js.map +1 -1
- package/dist/src/services/bridge/utils.d.ts +12 -12
- package/dist/src/services/bridge/utils.js +78 -51
- package/dist/src/services/bridge/utils.js.map +1 -1
- package/dist/src/services/index.d.ts +13 -7
- package/dist/src/services/index.js +129 -48
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/index.d.ts +1 -1
- package/dist/src/services/liquidity-pool/index.js +5 -8
- package/dist/src/services/liquidity-pool/index.js.map +1 -1
- package/dist/src/services/liquidity-pool/raw-pool-transaction-builder.js +3 -3
- package/dist/src/services/liquidity-pool/raw-pool-transaction-builder.js.map +1 -1
- package/dist/src/services/liquidity-pool/trx/index.js +3 -3
- package/dist/src/services/liquidity-pool/trx/index.js.map +1 -1
- package/dist/src/services/models/abi/OftBridge.d.ts +386 -0
- package/dist/src/services/models/abi/OftBridge.js +500 -0
- package/dist/src/services/models/abi/OftBridge.js.map +1 -0
- package/dist/src/services/models/sui/_dependencies/source/0x1/ascii/structs.d.ts +2 -2
- package/dist/src/services/models/sui/_dependencies/source/0x1/bit-vector/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x1/fixed-point32/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x1/string/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x1/type-name/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x1/uq32-32/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x1/uq64-64/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x31cc14d80c175ae39777c0238f20594c6d4869cfab199f40b69f3319956b8beb/burn-message/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x31cc14d80c175ae39777c0238f20594c6d4869cfab199f40b69f3319956b8beb/handle-receive-message/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x31cc14d80c175ae39777c0238f20594c6d4869cfab199f40b69f3319956b8beb/message-transmitter-authenticator/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x31cc14d80c175ae39777c0238f20594c6d4869cfab199f40b69f3319956b8beb/state/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x346e3233f61eb0055713417bfaddda7dc3bf26816faad1f7606994a368b92917/mint-allowance/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x346e3233f61eb0055713417bfaddda7dc3bf26816faad1f7606994a368b92917/treasury/structs.d.ts +4 -4
- package/dist/src/services/models/sui/_dependencies/source/0x4931e06dce648b3931f890035bd196920770e913e43e45990b383f6486fdd0a5/message/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0x4931e06dce648b3931f890035bd196920770e913e43e45990b383f6486fdd0a5/state/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes20/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed-vaas/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/emitter/structs.d.ts +2 -2
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external-address/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/fee-collector/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/guardian/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/guardian-set/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/publish-message/structs.d.ts +2 -2
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set/structs.d.ts +2 -2
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/state/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_dependencies/source/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/vaa/structs.d.ts +1 -1
- package/dist/src/services/models/sui/_framework/util.d.ts +30 -3
- package/dist/src/services/models/sui/_framework/vector.d.ts +2 -2
- package/dist/src/services/models/sui/bridge/another-bridge/functions.d.ts +9 -9
- package/dist/src/services/models/sui/bridge/another-bridge/structs.d.ts +1 -1
- package/dist/src/services/models/sui/bridge/bridge/functions.d.ts +31 -31
- package/dist/src/services/models/sui/bridge/bridge/structs.d.ts +4 -4
- package/dist/src/services/models/sui/bridge/bridge-interface/functions.d.ts +54 -54
- package/dist/src/services/models/sui/bridge/events/functions.d.ts +9 -9
- package/dist/src/services/models/sui/bridge/events/structs.d.ts +9 -9
- package/dist/src/services/models/sui/bridge/pool/functions.d.ts +26 -26
- package/dist/src/services/models/sui/bridge/pool/structs.d.ts +3 -3
- package/dist/src/services/models/sui/bridge/pool-rewards/functions.d.ts +10 -10
- package/dist/src/services/models/sui/bridge/pool-rewards/structs.d.ts +1 -1
- package/dist/src/services/models/sui/bridge/pool-state/functions.d.ts +21 -21
- package/dist/src/services/models/sui/bridge/pool-state/structs.d.ts +1 -1
- package/dist/src/services/models/sui/bridge/user-deposit/functions.d.ts +7 -7
- package/dist/src/services/models/sui/bridge/user-deposit/structs.d.ts +1 -1
- package/dist/src/services/models/sui/cctp-bridge/cctp-bridge/functions.d.ts +19 -19
- package/dist/src/services/models/sui/cctp-bridge/cctp-bridge/structs.d.ts +3 -3
- package/dist/src/services/models/sui/cctp-bridge/cctp-bridge-interface/functions.d.ts +15 -15
- package/dist/src/services/models/sui/cctp-bridge/events/functions.d.ts +4 -4
- package/dist/src/services/models/sui/cctp-bridge/events/structs.d.ts +4 -4
- package/dist/src/services/models/sui/cctp-bridge/message-transmitter-authenticator/functions.d.ts +1 -1
- package/dist/src/services/models/sui/cctp-bridge/message-transmitter-authenticator/structs.d.ts +1 -1
- package/dist/src/services/models/sui/gas-oracle/gas-oracle/functions.d.ts +16 -16
- package/dist/src/services/models/sui/gas-oracle/gas-oracle/structs.d.ts +3 -3
- package/dist/src/services/models/sui/gas-oracle/gas-oracle-interface/functions.d.ts +13 -13
- package/dist/src/services/models/sui/messenger/events/functions.d.ts +2 -2
- package/dist/src/services/models/sui/messenger/events/structs.d.ts +2 -2
- package/dist/src/services/models/sui/messenger/messenger/functions.d.ts +18 -18
- package/dist/src/services/models/sui/messenger/messenger/structs.d.ts +2 -2
- package/dist/src/services/models/sui/messenger/messenger-interface/functions.d.ts +15 -15
- package/dist/src/services/models/sui/sui/address/functions.d.ts +10 -10
- package/dist/src/services/models/sui/sui/authenticator-state/functions.d.ts +13 -13
- package/dist/src/services/models/sui/sui/authenticator-state/structs.d.ts +5 -5
- package/dist/src/services/models/sui/sui/bag/functions.d.ts +10 -10
- package/dist/src/services/models/sui/sui/bag/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/balance/functions.d.ts +13 -13
- package/dist/src/services/models/sui/sui/balance/structs.d.ts +2 -2
- package/dist/src/services/models/sui/sui/bcs/functions.d.ts +29 -29
- package/dist/src/services/models/sui/sui/bcs/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/bls12381/functions.d.ts +43 -43
- package/dist/src/services/models/sui/sui/bls12381/structs.d.ts +5 -5
- package/dist/src/services/models/sui/sui/borrow/functions.d.ts +4 -4
- package/dist/src/services/models/sui/sui/clock/functions.d.ts +3 -3
- package/dist/src/services/models/sui/sui/clock/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/coin/functions.d.ts +45 -45
- package/dist/src/services/models/sui/sui/coin/structs.d.ts +7 -7
- package/dist/src/services/models/sui/sui/config/functions.d.ts +11 -11
- package/dist/src/services/models/sui/sui/deny-list/functions.d.ts +21 -21
- package/dist/src/services/models/sui/sui/deny-list/structs.d.ts +7 -7
- package/dist/src/services/models/sui/sui/display/functions.d.ts +13 -13
- package/dist/src/services/models/sui/sui/display/structs.d.ts +3 -3
- package/dist/src/services/models/sui/sui/dynamic-field/functions.d.ts +16 -16
- package/dist/src/services/models/sui/sui/dynamic-object-field/functions.d.ts +12 -12
- package/dist/src/services/models/sui/sui/ecdsa-k1/functions.d.ts +3 -3
- package/dist/src/services/models/sui/sui/ecdsa-r1/functions.d.ts +2 -2
- package/dist/src/services/models/sui/sui/ecvrf/functions.d.ts +1 -1
- package/dist/src/services/models/sui/sui/ed25519/functions.d.ts +1 -1
- package/dist/src/services/models/sui/sui/event/functions.d.ts +1 -1
- package/dist/src/services/models/sui/sui/groth16/functions.d.ts +10 -10
- package/dist/src/services/models/sui/sui/groth16/structs.d.ts +4 -4
- package/dist/src/services/models/sui/sui/group-ops/functions.d.ts +23 -23
- package/dist/src/services/models/sui/sui/group-ops/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/hash/functions.d.ts +2 -2
- package/dist/src/services/models/sui/sui/hex/functions.d.ts +3 -3
- package/dist/src/services/models/sui/sui/hmac/functions.d.ts +1 -1
- package/dist/src/services/models/sui/sui/kiosk/functions.d.ts +41 -41
- package/dist/src/services/models/sui/sui/kiosk/structs.d.ts +10 -10
- package/dist/src/services/models/sui/sui/kiosk-extension/functions.d.ts +14 -14
- package/dist/src/services/models/sui/sui/kiosk-extension/structs.d.ts +2 -2
- package/dist/src/services/models/sui/sui/linked-table/functions.d.ts +17 -17
- package/dist/src/services/models/sui/sui/math/functions.d.ts +7 -7
- package/dist/src/services/models/sui/sui/object/functions.d.ts +24 -24
- package/dist/src/services/models/sui/sui/object/structs.d.ts +2 -2
- package/dist/src/services/models/sui/sui/object-bag/functions.d.ts +11 -11
- package/dist/src/services/models/sui/sui/object-bag/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/object-table/functions.d.ts +10 -10
- package/dist/src/services/models/sui/sui/object-table/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/package/functions.d.ts +24 -24
- package/dist/src/services/models/sui/sui/package/structs.d.ts +4 -4
- package/dist/src/services/models/sui/sui/pay/functions.d.ts +8 -8
- package/dist/src/services/models/sui/sui/poseidon/functions.d.ts +2 -2
- package/dist/src/services/models/sui/sui/priority-queue/functions.d.ts +8 -8
- package/dist/src/services/models/sui/sui/random/functions.d.ts +23 -23
- package/dist/src/services/models/sui/sui/random/structs.d.ts +3 -3
- package/dist/src/services/models/sui/sui/sui/functions.d.ts +2 -2
- package/dist/src/services/models/sui/sui/sui/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/table/functions.d.ts +10 -10
- package/dist/src/services/models/sui/sui/table/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/table-vec/functions.d.ts +12 -12
- package/dist/src/services/models/sui/sui/table-vec/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/token/functions.d.ts +45 -45
- package/dist/src/services/models/sui/sui/token/structs.d.ts +6 -6
- package/dist/src/services/models/sui/sui/transfer/functions.d.ts +13 -13
- package/dist/src/services/models/sui/sui/transfer/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/transfer-policy/functions.d.ts +18 -18
- package/dist/src/services/models/sui/sui/transfer-policy/structs.d.ts +6 -6
- package/dist/src/services/models/sui/sui/tx-context/functions.d.ts +7 -7
- package/dist/src/services/models/sui/sui/tx-context/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/types/functions.d.ts +1 -1
- package/dist/src/services/models/sui/sui/url/functions.d.ts +4 -4
- package/dist/src/services/models/sui/sui/url/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/vdf/functions.d.ts +4 -4
- package/dist/src/services/models/sui/sui/vec-map/functions.d.ts +19 -19
- package/dist/src/services/models/sui/sui/vec-set/functions.d.ts +12 -12
- package/dist/src/services/models/sui/sui/versioned/functions.d.ts +7 -7
- package/dist/src/services/models/sui/sui/versioned/structs.d.ts +2 -2
- package/dist/src/services/models/sui/sui/zklogin-verified-id/functions.d.ts +9 -9
- package/dist/src/services/models/sui/sui/zklogin-verified-id/structs.d.ts +1 -1
- package/dist/src/services/models/sui/sui/zklogin-verified-issuer/functions.d.ts +6 -6
- package/dist/src/services/models/sui/sui/zklogin-verified-issuer/structs.d.ts +1 -1
- package/dist/src/services/models/sui/utils/bytes32/functions.d.ts +14 -14
- package/dist/src/services/models/sui/utils/bytes32/structs.d.ts +1 -1
- package/dist/src/services/models/sui/utils/fee-collector/functions.d.ts +5 -5
- package/dist/src/services/models/sui/utils/fee-collector/structs.d.ts +1 -1
- package/dist/src/services/models/sui/utils/message/functions.d.ts +9 -9
- package/dist/src/services/models/sui/utils/message/structs.d.ts +1 -1
- package/dist/src/services/models/sui/utils/messenger-protocol/functions.d.ts +3 -3
- package/dist/src/services/models/sui/utils/messenger-protocol/structs.d.ts +1 -1
- package/dist/src/services/models/sui/utils/set/functions.d.ts +5 -5
- package/dist/src/services/models/sui/utils/set/structs.d.ts +2 -2
- package/dist/src/services/models/sui/utils/version/functions.d.ts +3 -3
- package/dist/src/services/models/sui/utils/version/structs.d.ts +1 -1
- package/dist/src/services/models/sui/wormhole-messenger/events/functions.d.ts +2 -2
- package/dist/src/services/models/sui/wormhole-messenger/events/structs.d.ts +2 -2
- package/dist/src/services/models/sui/wormhole-messenger/wh-messenger-interface/functions.d.ts +15 -15
- package/dist/src/services/models/sui/wormhole-messenger/wormhole-messenger/functions.d.ts +20 -20
- package/dist/src/services/models/sui/wormhole-messenger/wormhole-messenger/structs.d.ts +2 -2
- package/dist/src/services/token/index.js +9 -12
- package/dist/src/services/token/index.js.map +1 -1
- package/dist/src/tokens-info/tokens-info.model.d.ts +14 -0
- package/dist/src/tokens-info/tokens-info.model.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 +14 -13
- package/dist/src/utils/tronweb/lazy-load-tronweb-import.d.ts +0 -1
- package/dist/src/utils/tronweb/lazy-load-tronweb-import.js +0 -35
- package/dist/src/utils/tronweb/lazy-load-tronweb-import.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raw-pool-transaction-builder.js","sourceRoot":"","sources":["../../../../src/services/liquidity-pool/raw-pool-transaction-builder.ts"],"names":[],"mappings":";;;AAGA,yDAAkE;AAClE,iEAAqE;AACrE,6CAAiF;AAIjF,mCAA8C;AAqC9C,MAAa,gCAAgC;IAEjC;IACA;IACA;IACA;IAJV,YACU,GAAwB,EACxB,iBAAoC,EACpC,MAA+B,EAC/B,YAA0B;QAH1B,QAAG,GAAH,GAAG,CAAqB;QACxB,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,WAAM,GAAN,MAAM,CAAyB;QAC/B,iBAAY,GAAZ,YAAY,CAAc;IACjC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,CAA2B,EAAE,CAAiB;QAC1D,IAAI,CAAC,EAAE,CAAC;YACN,MAAM,QAAQ,GAAG,CAAa,CAAC;YAC/B,MAAM,WAAW,GAAkB,CAAC,CAAC;YACrC,OAAO,IAAI,CAAC,YAAY,CAAC,0BAA0B,CACjD;gBACE,GAAG,WAAW;gBACd,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,WAAW;aACvC,EACD,QAAQ,CACT,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,WAAW,GAAkB,CAAkB,CAAC;YACtD,OAAO,IAAI,CAAC,YAAY,CAAC,0BAA0B,CAAC;gBAClD,GAAG,WAAW;gBACd,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,WAAW;aACvC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAAsC,EAAE,QAAmB;QACvE,IAAA,4BAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACpC,IAAA,8BAAsB,EAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACvE,MAAM,CAAC,MAAM,GAAG,IAAA,qCAAuB,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;QACxF,OAAO,
|
|
1
|
+
{"version":3,"file":"raw-pool-transaction-builder.js","sourceRoot":"","sources":["../../../../src/services/liquidity-pool/raw-pool-transaction-builder.ts"],"names":[],"mappings":";;;AAGA,yDAAkE;AAClE,iEAAqE;AACrE,6CAAiF;AAIjF,mCAA8C;AAqC9C,MAAa,gCAAgC;IAEjC;IACA;IACA;IACA;IAJV,YACU,GAAwB,EACxB,iBAAoC,EACpC,MAA+B,EAC/B,YAA0B;QAH1B,QAAG,GAAH,GAAG,CAAqB;QACxB,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,WAAM,GAA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AAC,CAAC;QACpC,IAAA,8BAAsB,EAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACvE,MAAM,CAAC,MAAM,GAAG,IAAA,qCAAuB,EAAC,MAAM,CAAC,MAAM,EAAE,4BAAgB,CAAC,CAAC,OAAO,EAAE,CAAC;QACnF,OAAO,IAAA,2BAAmB,EACxB,MAAM,CAAC,KAAK,CAAC,WAAW,EACxB,IAAI,CAAC,GAAG,EACR,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,MAAM,EACX,QAAQ,CACT,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAA4B,EAAE,QAAmB;QAClE,OAAO,IAAA,2BAAmB,EACxB,MAAM,CAAC,KAAK,CAAC,WAAW,EACxB,IAAI,CAAC,GAAG,EACR,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,MAAM,EACX,QAAQ,CACT,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;CACF;AA/DD,4EA+DC","sourcesContent":["import { NodeRpcUrlsConfig } from \"..\";\nimport { AllbridgeCoreClient } from \"../../client/core-api/core-client-base\";\nimport { AllbridgeCoreSdkOptions } from \"../../index\";\nimport { convertFloatAmountToInt } from \"../../utils/calculation\";\nimport { SYSTEM_PRECISION } from \"../../utils/calculation/constants\";\nimport { validateAmountDecimals, validateAmountGtZero } from \"../../utils/utils\";\nimport { Provider, RawTransaction } from \"../models\";\nimport { TokenService } from \"../token\";\nimport { ApproveParams, LiquidityPoolsParams, LiquidityPoolsParamsWithAmount } from \"./models\";\nimport { getChainPoolService } from \"./index\";\n\nexport interface RawPoolTransactionBuilder {\n /**\n * Creates a Raw Transaction for approving tokens usage by the bridge\n * @param provider - will be used to access the network\n * @param approveData\n */\n approve(provider: Provider, approveData: ApproveParams): Promise<RawTransaction>;\n /**\n * Creates a Raw Transaction for approving tokens usage by the bridge\n * @param approveData\n */\n approve(approveData: ApproveParams): Promise<RawTransaction>;\n\n /**\n * Creates a Raw Transaction for depositing tokens to Liquidity pools\n * @param params\n * @param provider - will be used to access the network\n */\n deposit(params: LiquidityPoolsParamsWithAmount, provider?: Provider): Promise<RawTransaction>;\n\n /**\n * Creates a Raw Transaction for withdrawing tokens from Liquidity pools\n * @param params\n * @param provider - will be used to access the network\n */\n withdraw(params: LiquidityPoolsParamsWithAmount, provider?: Provider): Promise<RawTransaction>;\n\n /**\n * Creates a Raw Transaction for claiming rewards from Liquidity pools\n * @param params\n * @param provider - will be used to access the network\n */\n claimRewards(params: LiquidityPoolsParams, provider?: Provider): Promise<RawTransaction>;\n}\n\nexport class DefaultRawPoolTransactionBuilder implements RawPoolTransactionBuilder {\n constructor(\n private api: AllbridgeCoreClient,\n private nodeRpcUrlsConfig: NodeRpcUrlsConfig,\n private params: AllbridgeCoreSdkOptions,\n private tokenService: TokenService\n ) {}\n\n async approve(a: Provider | ApproveParams, b?: ApproveParams): Promise<RawTransaction> {\n if (b) {\n const provider = a as Provider;\n const approveData: ApproveParams = b;\n return this.tokenService.buildRawTransactionApprove(\n {\n ...approveData,\n spender: approveData.token.poolAddress,\n },\n provider\n );\n } else {\n const approveData: ApproveParams = a as ApproveParams;\n return this.tokenService.buildRawTransactionApprove({\n ...approveData,\n spender: approveData.token.poolAddress,\n });\n }\n }\n\n async deposit(params: LiquidityPoolsParamsWithAmount, provider?: Provider): Promise<RawTransaction> {\n validateAmountGtZero(params.amount);\n validateAmountDecimals(\"amount\", params.amount, params.token.decimals);\n params.amount = convertFloatAmountToInt(params.amount, params.token.decimals).toFixed();\n return getChainPoolService(\n params.token.chainSymbol,\n this.api,\n this.nodeRpcUrlsConfig,\n this.params,\n provider\n ).buildRawTransactionDeposit(params);\n }\n\n async withdraw(params: LiquidityPoolsParamsWithAmount, provider?: Provider): Promise<RawTransaction> {\n validateAmountGtZero(params.amount);\n validateAmountDecimals(\"amount\", params.amount, params.token.decimals);\n params.amount = convertFloatAmountToInt(params.amount, SYSTEM_PRECISION).toFixed();\n return getChainPoolService(\n params.token.chainSymbol,\n this.api,\n this.nodeRpcUrlsConfig,\n this.params,\n provider\n ).buildRawTransactionWithdraw(params);\n }\n\n async claimRewards(params: LiquidityPoolsParams, provider?: Provider): Promise<RawTransaction> {\n return getChainPoolService(\n params.token.chainSymbol,\n this.api,\n this.nodeRpcUrlsConfig,\n this.params,\n provider\n ).buildRawTransactionClaimRewards(params);\n }\n}\n"]}
|
|
@@ -40,8 +40,8 @@ class TronPoolService extends models_1.ChainPoolService {
|
|
|
40
40
|
return userBalanceInfo;
|
|
41
41
|
}
|
|
42
42
|
async getUserBalanceInfoByBatch(tronJsonRpc, accountAddress, token) {
|
|
43
|
-
const contractAddress =
|
|
44
|
-
const userAddress =
|
|
43
|
+
const contractAddress = (0, utils_1.tronAddressToEthAddress)(token.poolAddress);
|
|
44
|
+
const userAddress = (0, utils_1.tronAddressToEthAddress)(accountAddress);
|
|
45
45
|
const payload = [
|
|
46
46
|
{
|
|
47
47
|
jsonrpc: "2.0",
|
|
@@ -102,7 +102,7 @@ class TronPoolService extends models_1.ChainPoolService {
|
|
|
102
102
|
return poolInfo;
|
|
103
103
|
}
|
|
104
104
|
async getPoolInfoByBatch(tronJsonRpc, token) {
|
|
105
|
-
const contractAddress =
|
|
105
|
+
const contractAddress = (0, utils_1.tronAddressToEthAddress)(token.poolAddress);
|
|
106
106
|
const payload = [
|
|
107
107
|
{
|
|
108
108
|
jsonrpc: "2.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/liquidity-pool/trx/index.ts"],"names":[],"mappings":";;;;;;AACA,+BAAqC;AACrC,+CAAkD;AAElD,6DAAwD;AAExD,oDAA+C;AAE/C,4DAAwE;AACxE,8CAA6D;AAE7D,iEAAyC;AACzC,sCAMmB;AAEnB,MAAa,eAAgB,SAAQ,yBAAgB;IAK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IAAI,KAAK,CAAC,GAAG,IAAI,+BAA+B,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,IAAA,iCAAkB,EAAC,OAA8B,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;CACF;AAhRD,0CAgRC","sourcesContent":["import { TronWeb } from \"tronweb\";\nimport { AbiItem, Web3 } from \"web3\";\nimport { encodeFunctionCall } from \"web3-eth-abi\";\nimport { AbiFunctionFragment } from \"web3-types\";\nimport { ChainType } from \"../../../chains/chain.enums\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { SdkError } from \"../../../exceptions\";\nimport { PoolInfo, TokenWithChainDetails } from \"../../../tokens-info\";\nimport { calculatePoolInfoImbalance } from \"../../../utils/calculation\";\nimport { tronAddressToEthAddress } from \"../../bridge/utils\";\nimport { RawTransaction, SmartContractMethodParameter } from \"../../models\";\nimport Pool from \"../../models/abi/Pool\";\nimport {\n ChainPoolService,\n LiquidityPoolsParams,\n LiquidityPoolsParamsWithAmount,\n UserBalance,\n UserBalanceInfo,\n} from \"../models\";\n\nexport class TronPoolService extends ChainPoolService {\n chainType: ChainType.TRX = ChainType.TRX;\n private P = 52;\n\n constructor(\n public tronWeb: TronWeb,\n public api: AllbridgeCoreClient,\n private readonly tronJsonRpc: string | undefined\n ) {\n super();\n }\n\n async getUserBalanceInfo(accountAddress: string, token: TokenWithChainDetails): Promise<UserBalanceInfo> {\n let userBalanceInfo;\n if (this.tronJsonRpc) {\n try {\n userBalanceInfo = await this.getUserBalanceInfoByBatch(this.tronJsonRpc, accountAddress, token);\n } catch (ignoreError) {\n userBalanceInfo = await this.getUserBalanceInfoPerProperty(accountAddress, token);\n }\n } else {\n userBalanceInfo = await this.getUserBalanceInfoPerProperty(accountAddress, token);\n }\n return userBalanceInfo;\n }\n\n private async getUserBalanceInfoByBatch(\n tronJsonRpc: string,\n accountAddress: string,\n token: TokenWithChainDetails\n ): Promise<UserBalanceInfo> {\n const contractAddress = await tronAddressToEthAddress(token.poolAddress);\n const userAddress = await tronAddressToEthAddress(accountAddress);\n\n const payload = [\n {\n jsonrpc: \"2.0\",\n id: 1,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"userRewardDebt\", userAddress) }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 2,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"balanceOf\", userAddress) }, \"latest\"],\n },\n ];\n\n const response = await fetch(tronJsonRpc, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n });\n\n const results = await response.json();\n\n if (Array.isArray(results) && results.length === 2) {\n const getResult = (id: number) => {\n const entry = results.find((r) => r.id === id);\n if (!entry || !entry.result) {\n throw new Error(`Missing or invalid result for id ${id}`);\n }\n return Web3.utils.toBigInt(entry.result).toString();\n };\n\n return new UserBalance({\n lpAmount: Web3.utils.toBigInt(getResult(2)).toString(),\n rewardDebt: Web3.utils.toBigInt(getResult(1)).toString(),\n });\n }\n\n throw new Error(\"Batched HTTP call failed\");\n }\n\n private async getUserBalanceInfoPerProperty(\n accountAddress: string,\n token: TokenWithChainDetails\n ): Promise<UserBalanceInfo> {\n if (!this.tronWeb.defaultAddress.base58) {\n this.tronWeb.setAddress(accountAddress);\n }\n const contract = this.getContract(token.poolAddress);\n const rewardDebt = (await contract.methods.userRewardDebt(accountAddress).call()).toString();\n const lpAmount = (await contract.methods.balanceOf(accountAddress).call()).toString();\n return new UserBalance({ lpAmount, rewardDebt });\n }\n\n async getPoolInfoFromChain(token: TokenWithChainDetails): Promise<PoolInfo> {\n let poolInfo;\n if (this.tronJsonRpc) {\n try {\n poolInfo = await this.getPoolInfoByBatch(this.tronJsonRpc, token);\n } catch (ignoreError) {\n poolInfo = await this.getPoolInfoPerProperty(token);\n }\n } else {\n poolInfo = await this.getPoolInfoPerProperty(token);\n }\n return poolInfo;\n }\n\n private async getPoolInfoByBatch(tronJsonRpc: string, token: TokenWithChainDetails): Promise<PoolInfo> {\n const contractAddress = await tronAddressToEthAddress(token.poolAddress);\n\n const payload = [\n {\n jsonrpc: \"2.0\",\n id: 1,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"a\") }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 2,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"d\") }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 3,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"tokenBalance\") }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 4,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"vUsdBalance\") }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 5,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"totalSupply\") }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 6,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"accRewardPerShareP\") }, \"latest\"],\n },\n ];\n\n const response = await fetch(tronJsonRpc, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n });\n\n const results = await response.json();\n\n if (Array.isArray(results) && results.length === 6) {\n const getResult = (id: number) => {\n const entry = results.find((r) => r.id === id);\n if (!entry || !entry.result) {\n throw new Error(`Missing or invalid result for id ${id}`);\n }\n return Web3.utils.toBigInt(entry.result).toString();\n };\n\n const tokenBalanceStr = getResult(3);\n const vUsdBalanceStr = getResult(4);\n const imbalance = calculatePoolInfoImbalance({ tokenBalance: tokenBalanceStr, vUsdBalance: vUsdBalanceStr });\n\n return {\n aValue: getResult(1),\n dValue: getResult(2),\n tokenBalance: tokenBalanceStr,\n vUsdBalance: vUsdBalanceStr,\n totalLpAmount: getResult(5),\n accRewardPerShareP: getResult(6),\n p: this.P,\n imbalance,\n };\n }\n\n throw new Error(\"Batched pool info call failed\");\n }\n\n private async getPoolInfoPerProperty(token: TokenWithChainDetails): Promise<PoolInfo> {\n if (!this.tronWeb.defaultAddress.base58) {\n this.tronWeb.setAddress(token.poolAddress);\n }\n const poolContract = this.getContract(token.poolAddress);\n const [aValue, dValue, tokenBalance, vUsdBalance, totalLpAmount, accRewardPerShareP] = await Promise.all([\n poolContract.methods.a().call(),\n poolContract.methods.d().call(),\n poolContract.methods.tokenBalance().call(),\n poolContract.methods.vUsdBalance().call(),\n poolContract.methods.totalSupply().call(),\n poolContract.methods.accRewardPerShareP().call(),\n ]);\n const tokenBalanceStr = tokenBalance.toString();\n const vUsdBalanceStr = vUsdBalance.toString();\n const imbalance = calculatePoolInfoImbalance({ tokenBalance: tokenBalanceStr, vUsdBalance: vUsdBalanceStr });\n return {\n aValue: aValue.toString(),\n dValue: dValue.toString(),\n tokenBalance: tokenBalanceStr,\n vUsdBalance: vUsdBalanceStr,\n totalLpAmount: totalLpAmount.toString(),\n accRewardPerShareP: accRewardPerShareP.toString(),\n p: this.P,\n imbalance,\n };\n }\n\n buildRawTransactionDeposit(params: LiquidityPoolsParamsWithAmount): Promise<RawTransaction> {\n const { amount, accountAddress } = params;\n\n const parameter = [{ type: \"uint256\", value: amount }];\n const methodSignature = \"deposit(uint256)\";\n\n return this.buildRawTransaction(params.token.poolAddress, methodSignature, parameter, \"0\", accountAddress);\n }\n\n buildRawTransactionWithdraw(params: LiquidityPoolsParamsWithAmount): Promise<RawTransaction> {\n const { amount, accountAddress } = params;\n\n const parameter = [{ type: \"uint256\", value: amount }];\n const methodSignature = \"withdraw(uint256)\";\n\n return this.buildRawTransaction(params.token.poolAddress, methodSignature, parameter, \"0\", accountAddress);\n }\n\n buildRawTransactionClaimRewards(params: LiquidityPoolsParams): Promise<RawTransaction> {\n const { accountAddress } = params;\n\n const parameter: SmartContractMethodParameter[] = [];\n const methodSignature = \"claimRewards()\";\n\n return this.buildRawTransaction(params.token.poolAddress, methodSignature, parameter, \"0\", accountAddress);\n }\n\n private async buildRawTransaction(\n contractAddress: string,\n methodSignature: string,\n parameter: SmartContractMethodParameter[],\n value: string,\n fromAddress: string\n ): Promise<RawTransaction> {\n const transactionObject = await this.tronWeb.transactionBuilder.triggerSmartContract(\n contractAddress,\n methodSignature,\n {\n callValue: +value,\n },\n parameter,\n fromAddress\n );\n if (!transactionObject?.result?.result) {\n throw new SdkError(\"Unknown error: \" + JSON.stringify(transactionObject, null, 2));\n }\n return transactionObject.transaction;\n }\n\n private getContract(contractAddress: string): any {\n return this.tronWeb.contract(Pool.abi, contractAddress);\n }\n\n private getFunctionAbi(name: string, ...params: string[]): string {\n const abiItem = (Pool.abi as ReadonlyArray<AbiItem>).find(\n (item) => item.type === \"function\" && \"name\" in item && item.name === name\n );\n\n if (!abiItem) {\n throw new Error(`${name} method not found in Pool ABI`);\n }\n\n return encodeFunctionCall(abiItem as AbiFunctionFragment, params);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/services/liquidity-pool/trx/index.ts"],"names":[],"mappings":";;;;;;AACA,+BAAqC;AACrC,+CAAkD;AAElD,6DAAwD;AAExD,oDAA+C;AAE/C,4DAAwE;AACxE,8CAA6D;AAE7D,iEAAyC;AACzC,sCAMmB;AAEnB,MAAa,eAAgB,SAAQ,yBAAgB;IAK1C;IACA;IACU;IANnB,SAAS,GAAkB,uBAAS,CAAC,GAAG,CAAC;IACjC,CAAC,GAAG,EAAE,CAAC;IAEf,YACS,OAAgB,EAChB,GAAwB,EACd,WAA+B;QAEhD,KAAK,EAAE,CAAC;QAJD,YAAO,GAAP,OAAO,CAAS;QAChB,QAAG,GAAH,GAAG,CAAqB;QACd,gBAAW,GAAX,WAAW,CAAoB;IAGlD,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,cAAsB,EAAE,KAA4B;QAC3E,IAAI,eAAe,CAAC;QACpB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,IAAI,CAAC;gBACH,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,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,oBAAoB,CAClF,eAAe,EACf,eAAe,EACf;YACE,SAAS,EAAE,CAAC,KAAK;SAClB,EACD,SAAS,EACT,WAAW,CACZ,CAAC;QACF,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;YACvC,MAAM,IAAI,qBAAQ,CAAC,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACrF,CAAC;QACD,OAAO,iBAAiB,CAAC,WAAW,CAAC;IACvC,CAAC;IAEO,WAAW,CAAC,eAAuB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAI,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;IAEO,cAAc,CAAC,IAAY,EAAE,GAAG,MAAgB;QACtD,MAAM,OAAO,GAAI,cAAI,CAAC,GAA8B,CAAC,IAAI,CACvD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAC3E,CAAC;QAEF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,+BAA+B,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,IAAA,iCAAkB,EAAC,OAA8B,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC;CACF;AAhRD,0CAgRC","sourcesContent":["import { TronWeb } from \"tronweb\";\nimport { AbiItem, Web3 } from \"web3\";\nimport { encodeFunctionCall } from \"web3-eth-abi\";\nimport { AbiFunctionFragment } from \"web3-types\";\nimport { ChainType } from \"../../../chains/chain.enums\";\nimport { AllbridgeCoreClient } from \"../../../client/core-api/core-client-base\";\nimport { SdkError } from \"../../../exceptions\";\nimport { PoolInfo, TokenWithChainDetails } from \"../../../tokens-info\";\nimport { calculatePoolInfoImbalance } from \"../../../utils/calculation\";\nimport { tronAddressToEthAddress } from \"../../bridge/utils\";\nimport { RawTransaction, SmartContractMethodParameter } from \"../../models\";\nimport Pool from \"../../models/abi/Pool\";\nimport {\n ChainPoolService,\n LiquidityPoolsParams,\n LiquidityPoolsParamsWithAmount,\n UserBalance,\n UserBalanceInfo,\n} from \"../models\";\n\nexport class TronPoolService extends ChainPoolService {\n chainType: ChainType.TRX = ChainType.TRX;\n private P = 52;\n\n constructor(\n public tronWeb: TronWeb,\n public api: AllbridgeCoreClient,\n private readonly tronJsonRpc: string | undefined\n ) {\n super();\n }\n\n async getUserBalanceInfo(accountAddress: string, token: TokenWithChainDetails): Promise<UserBalanceInfo> {\n let userBalanceInfo;\n if (this.tronJsonRpc) {\n try {\n userBalanceInfo = await this.getUserBalanceInfoByBatch(this.tronJsonRpc, accountAddress, token);\n } catch (ignoreError) {\n userBalanceInfo = await this.getUserBalanceInfoPerProperty(accountAddress, token);\n }\n } else {\n userBalanceInfo = await this.getUserBalanceInfoPerProperty(accountAddress, token);\n }\n return userBalanceInfo;\n }\n\n private async getUserBalanceInfoByBatch(\n tronJsonRpc: string,\n accountAddress: string,\n token: TokenWithChainDetails\n ): Promise<UserBalanceInfo> {\n const contractAddress = tronAddressToEthAddress(token.poolAddress);\n const userAddress = tronAddressToEthAddress(accountAddress);\n\n const payload = [\n {\n jsonrpc: \"2.0\",\n id: 1,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"userRewardDebt\", userAddress) }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 2,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"balanceOf\", userAddress) }, \"latest\"],\n },\n ];\n\n const response = await fetch(tronJsonRpc, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n });\n\n const results = await response.json();\n\n if (Array.isArray(results) && results.length === 2) {\n const getResult = (id: number) => {\n const entry = results.find((r) => r.id === id);\n if (!entry || !entry.result) {\n throw new Error(`Missing or invalid result for id ${id}`);\n }\n return Web3.utils.toBigInt(entry.result).toString();\n };\n\n return new UserBalance({\n lpAmount: Web3.utils.toBigInt(getResult(2)).toString(),\n rewardDebt: Web3.utils.toBigInt(getResult(1)).toString(),\n });\n }\n\n throw new Error(\"Batched HTTP call failed\");\n }\n\n private async getUserBalanceInfoPerProperty(\n accountAddress: string,\n token: TokenWithChainDetails\n ): Promise<UserBalanceInfo> {\n if (!this.tronWeb.defaultAddress.base58) {\n this.tronWeb.setAddress(accountAddress);\n }\n const contract = this.getContract(token.poolAddress);\n const rewardDebt = (await contract.methods.userRewardDebt(accountAddress).call()).toString();\n const lpAmount = (await contract.methods.balanceOf(accountAddress).call()).toString();\n return new UserBalance({ lpAmount, rewardDebt });\n }\n\n async getPoolInfoFromChain(token: TokenWithChainDetails): Promise<PoolInfo> {\n let poolInfo;\n if (this.tronJsonRpc) {\n try {\n poolInfo = await this.getPoolInfoByBatch(this.tronJsonRpc, token);\n } catch (ignoreError) {\n poolInfo = await this.getPoolInfoPerProperty(token);\n }\n } else {\n poolInfo = await this.getPoolInfoPerProperty(token);\n }\n return poolInfo;\n }\n\n private async getPoolInfoByBatch(tronJsonRpc: string, token: TokenWithChainDetails): Promise<PoolInfo> {\n const contractAddress = tronAddressToEthAddress(token.poolAddress);\n\n const payload = [\n {\n jsonrpc: \"2.0\",\n id: 1,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"a\") }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 2,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"d\") }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 3,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"tokenBalance\") }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 4,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"vUsdBalance\") }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 5,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"totalSupply\") }, \"latest\"],\n },\n {\n jsonrpc: \"2.0\",\n id: 6,\n method: \"eth_call\",\n params: [{ to: contractAddress, data: this.getFunctionAbi(\"accRewardPerShareP\") }, \"latest\"],\n },\n ];\n\n const response = await fetch(tronJsonRpc, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n });\n\n const results = await response.json();\n\n if (Array.isArray(results) && results.length === 6) {\n const getResult = (id: number) => {\n const entry = results.find((r) => r.id === id);\n if (!entry || !entry.result) {\n throw new Error(`Missing or invalid result for id ${id}`);\n }\n return Web3.utils.toBigInt(entry.result).toString();\n };\n\n const tokenBalanceStr = getResult(3);\n const vUsdBalanceStr = getResult(4);\n const imbalance = calculatePoolInfoImbalance({ tokenBalance: tokenBalanceStr, vUsdBalance: vUsdBalanceStr });\n\n return {\n aValue: getResult(1),\n dValue: getResult(2),\n tokenBalance: tokenBalanceStr,\n vUsdBalance: vUsdBalanceStr,\n totalLpAmount: getResult(5),\n accRewardPerShareP: getResult(6),\n p: this.P,\n imbalance,\n };\n }\n\n throw new Error(\"Batched pool info call failed\");\n }\n\n private async getPoolInfoPerProperty(token: TokenWithChainDetails): Promise<PoolInfo> {\n if (!this.tronWeb.defaultAddress.base58) {\n this.tronWeb.setAddress(token.poolAddress);\n }\n const poolContract = this.getContract(token.poolAddress);\n const [aValue, dValue, tokenBalance, vUsdBalance, totalLpAmount, accRewardPerShareP] = await Promise.all([\n poolContract.methods.a().call(),\n poolContract.methods.d().call(),\n poolContract.methods.tokenBalance().call(),\n poolContract.methods.vUsdBalance().call(),\n poolContract.methods.totalSupply().call(),\n poolContract.methods.accRewardPerShareP().call(),\n ]);\n const tokenBalanceStr = tokenBalance.toString();\n const vUsdBalanceStr = vUsdBalance.toString();\n const imbalance = calculatePoolInfoImbalance({ tokenBalance: tokenBalanceStr, vUsdBalance: vUsdBalanceStr });\n return {\n aValue: aValue.toString(),\n dValue: dValue.toString(),\n tokenBalance: tokenBalanceStr,\n vUsdBalance: vUsdBalanceStr,\n totalLpAmount: totalLpAmount.toString(),\n accRewardPerShareP: accRewardPerShareP.toString(),\n p: this.P,\n imbalance,\n };\n }\n\n buildRawTransactionDeposit(params: LiquidityPoolsParamsWithAmount): Promise<RawTransaction> {\n const { amount, accountAddress } = params;\n\n const parameter = [{ type: \"uint256\", value: amount }];\n const methodSignature = \"deposit(uint256)\";\n\n return this.buildRawTransaction(params.token.poolAddress, methodSignature, parameter, \"0\", accountAddress);\n }\n\n buildRawTransactionWithdraw(params: LiquidityPoolsParamsWithAmount): Promise<RawTransaction> {\n const { amount, accountAddress } = params;\n\n const parameter = [{ type: \"uint256\", value: amount }];\n const methodSignature = \"withdraw(uint256)\";\n\n return this.buildRawTransaction(params.token.poolAddress, methodSignature, parameter, \"0\", accountAddress);\n }\n\n buildRawTransactionClaimRewards(params: LiquidityPoolsParams): Promise<RawTransaction> {\n const { accountAddress } = params;\n\n const parameter: SmartContractMethodParameter[] = [];\n const methodSignature = \"claimRewards()\";\n\n return this.buildRawTransaction(params.token.poolAddress, methodSignature, parameter, \"0\", accountAddress);\n }\n\n private async buildRawTransaction(\n contractAddress: string,\n methodSignature: string,\n parameter: SmartContractMethodParameter[],\n value: string,\n fromAddress: string\n ): Promise<RawTransaction> {\n const transactionObject = await this.tronWeb.transactionBuilder.triggerSmartContract(\n contractAddress,\n methodSignature,\n {\n callValue: +value,\n },\n parameter,\n fromAddress\n );\n if (!transactionObject?.result?.result) {\n throw new SdkError(\"Unknown error: \" + JSON.stringify(transactionObject, null, 2));\n }\n return transactionObject.transaction;\n }\n\n private getContract(contractAddress: string): any {\n return this.tronWeb.contract(Pool.abi, contractAddress);\n }\n\n private getFunctionAbi(name: string, ...params: string[]): string {\n const abiItem = (Pool.abi as ReadonlyArray<AbiItem>).find(\n (item) => item.type === \"function\" && \"name\" in item && item.name === name\n );\n\n if (!abiItem) {\n throw new Error(`${name} method not found in Pool ABI`);\n }\n\n return encodeFunctionCall(abiItem as AbiFunctionFragment, params);\n }\n}\n"]}
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
declare const artifact: {
|
|
2
|
+
readonly abi: readonly [{
|
|
3
|
+
readonly inputs: readonly [{
|
|
4
|
+
readonly internalType: "uint256";
|
|
5
|
+
readonly name: "chainId_";
|
|
6
|
+
readonly type: "uint256";
|
|
7
|
+
}, {
|
|
8
|
+
readonly internalType: "uint256";
|
|
9
|
+
readonly name: "chainPrecision_";
|
|
10
|
+
readonly type: "uint256";
|
|
11
|
+
}, {
|
|
12
|
+
readonly internalType: "contract IGasOracle";
|
|
13
|
+
readonly name: "gasOracle_";
|
|
14
|
+
readonly type: "address";
|
|
15
|
+
}];
|
|
16
|
+
readonly stateMutability: "nonpayable";
|
|
17
|
+
readonly type: "constructor";
|
|
18
|
+
}, {
|
|
19
|
+
readonly inputs: readonly [{
|
|
20
|
+
readonly internalType: "uint16";
|
|
21
|
+
readonly name: "optionType";
|
|
22
|
+
readonly type: "uint16";
|
|
23
|
+
}];
|
|
24
|
+
readonly name: "InvalidOptionType";
|
|
25
|
+
readonly type: "error";
|
|
26
|
+
}, {
|
|
27
|
+
readonly anonymous: false;
|
|
28
|
+
readonly inputs: readonly [{
|
|
29
|
+
readonly indexed: false;
|
|
30
|
+
readonly internalType: "address";
|
|
31
|
+
readonly name: "sender";
|
|
32
|
+
readonly type: "address";
|
|
33
|
+
}, {
|
|
34
|
+
readonly indexed: false;
|
|
35
|
+
readonly internalType: "bytes32";
|
|
36
|
+
readonly name: "recipient";
|
|
37
|
+
readonly type: "bytes32";
|
|
38
|
+
}, {
|
|
39
|
+
readonly indexed: false;
|
|
40
|
+
readonly internalType: "address";
|
|
41
|
+
readonly name: "tokenAddress";
|
|
42
|
+
readonly type: "address";
|
|
43
|
+
}, {
|
|
44
|
+
readonly indexed: false;
|
|
45
|
+
readonly internalType: "uint256";
|
|
46
|
+
readonly name: "amount";
|
|
47
|
+
readonly type: "uint256";
|
|
48
|
+
}, {
|
|
49
|
+
readonly indexed: false;
|
|
50
|
+
readonly internalType: "uint256";
|
|
51
|
+
readonly name: "destinationChainId";
|
|
52
|
+
readonly type: "uint256";
|
|
53
|
+
}, {
|
|
54
|
+
readonly indexed: false;
|
|
55
|
+
readonly internalType: "uint256";
|
|
56
|
+
readonly name: "receivedRelayerFeeFromGas";
|
|
57
|
+
readonly type: "uint256";
|
|
58
|
+
}, {
|
|
59
|
+
readonly indexed: false;
|
|
60
|
+
readonly internalType: "uint256";
|
|
61
|
+
readonly name: "receivedRelayerFeeFromTokens";
|
|
62
|
+
readonly type: "uint256";
|
|
63
|
+
}, {
|
|
64
|
+
readonly indexed: false;
|
|
65
|
+
readonly internalType: "uint256";
|
|
66
|
+
readonly name: "relayerFeeWithExtraGas";
|
|
67
|
+
readonly type: "uint256";
|
|
68
|
+
}, {
|
|
69
|
+
readonly indexed: false;
|
|
70
|
+
readonly internalType: "uint256";
|
|
71
|
+
readonly name: "receivedRelayerFeeTokenAmount";
|
|
72
|
+
readonly type: "uint256";
|
|
73
|
+
}, {
|
|
74
|
+
readonly indexed: false;
|
|
75
|
+
readonly internalType: "uint256";
|
|
76
|
+
readonly name: "adminFeeTokenAmount";
|
|
77
|
+
readonly type: "uint256";
|
|
78
|
+
}, {
|
|
79
|
+
readonly indexed: false;
|
|
80
|
+
readonly internalType: "uint256";
|
|
81
|
+
readonly name: "extraGasDestinationToken";
|
|
82
|
+
readonly type: "uint256";
|
|
83
|
+
}];
|
|
84
|
+
readonly name: "OftTokensSent";
|
|
85
|
+
readonly type: "event";
|
|
86
|
+
}, {
|
|
87
|
+
readonly anonymous: false;
|
|
88
|
+
readonly inputs: readonly [{
|
|
89
|
+
readonly indexed: true;
|
|
90
|
+
readonly internalType: "address";
|
|
91
|
+
readonly name: "previousOwner";
|
|
92
|
+
readonly type: "address";
|
|
93
|
+
}, {
|
|
94
|
+
readonly indexed: true;
|
|
95
|
+
readonly internalType: "address";
|
|
96
|
+
readonly name: "newOwner";
|
|
97
|
+
readonly type: "address";
|
|
98
|
+
}];
|
|
99
|
+
readonly name: "OwnershipTransferred";
|
|
100
|
+
readonly type: "event";
|
|
101
|
+
}, {
|
|
102
|
+
readonly anonymous: false;
|
|
103
|
+
readonly inputs: readonly [{
|
|
104
|
+
readonly indexed: false;
|
|
105
|
+
readonly internalType: "address";
|
|
106
|
+
readonly name: "sender";
|
|
107
|
+
readonly type: "address";
|
|
108
|
+
}, {
|
|
109
|
+
readonly indexed: false;
|
|
110
|
+
readonly internalType: "uint256";
|
|
111
|
+
readonly name: "amount";
|
|
112
|
+
readonly type: "uint256";
|
|
113
|
+
}];
|
|
114
|
+
readonly name: "ReceivedGas";
|
|
115
|
+
readonly type: "event";
|
|
116
|
+
}, {
|
|
117
|
+
readonly stateMutability: "payable";
|
|
118
|
+
readonly type: "fallback";
|
|
119
|
+
}, {
|
|
120
|
+
readonly inputs: readonly [{
|
|
121
|
+
readonly internalType: "address";
|
|
122
|
+
readonly name: "oft_";
|
|
123
|
+
readonly type: "address";
|
|
124
|
+
}];
|
|
125
|
+
readonly name: "addToken";
|
|
126
|
+
readonly outputs: readonly [];
|
|
127
|
+
readonly stateMutability: "nonpayable";
|
|
128
|
+
readonly type: "function";
|
|
129
|
+
}, {
|
|
130
|
+
readonly inputs: readonly [{
|
|
131
|
+
readonly internalType: "address";
|
|
132
|
+
readonly name: "tokenAddress";
|
|
133
|
+
readonly type: "address";
|
|
134
|
+
}];
|
|
135
|
+
readonly name: "adminFeeShareBP";
|
|
136
|
+
readonly outputs: readonly [{
|
|
137
|
+
readonly internalType: "uint256";
|
|
138
|
+
readonly name: "feeShare";
|
|
139
|
+
readonly type: "uint256";
|
|
140
|
+
}];
|
|
141
|
+
readonly stateMutability: "view";
|
|
142
|
+
readonly type: "function";
|
|
143
|
+
}, {
|
|
144
|
+
readonly inputs: readonly [{
|
|
145
|
+
readonly internalType: "address";
|
|
146
|
+
readonly name: "tokenAddress";
|
|
147
|
+
readonly type: "address";
|
|
148
|
+
}, {
|
|
149
|
+
readonly internalType: "uint256";
|
|
150
|
+
readonly name: "amount";
|
|
151
|
+
readonly type: "uint256";
|
|
152
|
+
}, {
|
|
153
|
+
readonly internalType: "bytes32";
|
|
154
|
+
readonly name: "recipient";
|
|
155
|
+
readonly type: "bytes32";
|
|
156
|
+
}, {
|
|
157
|
+
readonly internalType: "uint256";
|
|
158
|
+
readonly name: "destinationChainId";
|
|
159
|
+
readonly type: "uint256";
|
|
160
|
+
}, {
|
|
161
|
+
readonly internalType: "uint256";
|
|
162
|
+
readonly name: "relayerFeeTokenAmount";
|
|
163
|
+
readonly type: "uint256";
|
|
164
|
+
}, {
|
|
165
|
+
readonly internalType: "uint256";
|
|
166
|
+
readonly name: "extraGasInDestinationToken";
|
|
167
|
+
readonly type: "uint256";
|
|
168
|
+
}, {
|
|
169
|
+
readonly internalType: "uint256";
|
|
170
|
+
readonly name: "slippageBP";
|
|
171
|
+
readonly type: "uint256";
|
|
172
|
+
}];
|
|
173
|
+
readonly name: "bridge";
|
|
174
|
+
readonly outputs: readonly [];
|
|
175
|
+
readonly stateMutability: "payable";
|
|
176
|
+
readonly type: "function";
|
|
177
|
+
}, {
|
|
178
|
+
readonly inputs: readonly [];
|
|
179
|
+
readonly name: "chainId";
|
|
180
|
+
readonly outputs: readonly [{
|
|
181
|
+
readonly internalType: "uint256";
|
|
182
|
+
readonly name: "";
|
|
183
|
+
readonly type: "uint256";
|
|
184
|
+
}];
|
|
185
|
+
readonly stateMutability: "view";
|
|
186
|
+
readonly type: "function";
|
|
187
|
+
}, {
|
|
188
|
+
readonly inputs: readonly [{
|
|
189
|
+
readonly internalType: "address";
|
|
190
|
+
readonly name: "tokenAddress_";
|
|
191
|
+
readonly type: "address";
|
|
192
|
+
}, {
|
|
193
|
+
readonly internalType: "uint256";
|
|
194
|
+
readonly name: "destinationChainId_";
|
|
195
|
+
readonly type: "uint256";
|
|
196
|
+
}, {
|
|
197
|
+
readonly internalType: "uint128";
|
|
198
|
+
readonly name: "extraGasAmount_";
|
|
199
|
+
readonly type: "uint128";
|
|
200
|
+
}];
|
|
201
|
+
readonly name: "extraGasPrice";
|
|
202
|
+
readonly outputs: readonly [{
|
|
203
|
+
readonly internalType: "uint256";
|
|
204
|
+
readonly name: "";
|
|
205
|
+
readonly type: "uint256";
|
|
206
|
+
}];
|
|
207
|
+
readonly stateMutability: "view";
|
|
208
|
+
readonly type: "function";
|
|
209
|
+
}, {
|
|
210
|
+
readonly inputs: readonly [{
|
|
211
|
+
readonly internalType: "uint256";
|
|
212
|
+
readonly name: "chainId_";
|
|
213
|
+
readonly type: "uint256";
|
|
214
|
+
}];
|
|
215
|
+
readonly name: "getEidByChainId";
|
|
216
|
+
readonly outputs: readonly [{
|
|
217
|
+
readonly internalType: "uint32";
|
|
218
|
+
readonly name: "";
|
|
219
|
+
readonly type: "uint32";
|
|
220
|
+
}];
|
|
221
|
+
readonly stateMutability: "view";
|
|
222
|
+
readonly type: "function";
|
|
223
|
+
}, {
|
|
224
|
+
readonly inputs: readonly [{
|
|
225
|
+
readonly internalType: "address";
|
|
226
|
+
readonly name: "tokenAddress";
|
|
227
|
+
readonly type: "address";
|
|
228
|
+
}];
|
|
229
|
+
readonly name: "oftAddress";
|
|
230
|
+
readonly outputs: readonly [{
|
|
231
|
+
readonly internalType: "address";
|
|
232
|
+
readonly name: "oftAddress";
|
|
233
|
+
readonly type: "address";
|
|
234
|
+
}];
|
|
235
|
+
readonly stateMutability: "view";
|
|
236
|
+
readonly type: "function";
|
|
237
|
+
}, {
|
|
238
|
+
readonly inputs: readonly [];
|
|
239
|
+
readonly name: "owner";
|
|
240
|
+
readonly outputs: readonly [{
|
|
241
|
+
readonly internalType: "address";
|
|
242
|
+
readonly name: "";
|
|
243
|
+
readonly type: "address";
|
|
244
|
+
}];
|
|
245
|
+
readonly stateMutability: "view";
|
|
246
|
+
readonly type: "function";
|
|
247
|
+
}, {
|
|
248
|
+
readonly inputs: readonly [{
|
|
249
|
+
readonly internalType: "uint256";
|
|
250
|
+
readonly name: "chainId_";
|
|
251
|
+
readonly type: "uint256";
|
|
252
|
+
}, {
|
|
253
|
+
readonly internalType: "uint32";
|
|
254
|
+
readonly name: "eid_";
|
|
255
|
+
readonly type: "uint32";
|
|
256
|
+
}, {
|
|
257
|
+
readonly internalType: "uint128";
|
|
258
|
+
readonly name: "lzGasLimit_";
|
|
259
|
+
readonly type: "uint128";
|
|
260
|
+
}];
|
|
261
|
+
readonly name: "registerBridgeDestination";
|
|
262
|
+
readonly outputs: readonly [];
|
|
263
|
+
readonly stateMutability: "nonpayable";
|
|
264
|
+
readonly type: "function";
|
|
265
|
+
}, {
|
|
266
|
+
readonly inputs: readonly [{
|
|
267
|
+
readonly internalType: "address";
|
|
268
|
+
readonly name: "tokenAddress_";
|
|
269
|
+
readonly type: "address";
|
|
270
|
+
}, {
|
|
271
|
+
readonly internalType: "uint256";
|
|
272
|
+
readonly name: "destinationChainId_";
|
|
273
|
+
readonly type: "uint256";
|
|
274
|
+
}];
|
|
275
|
+
readonly name: "relayerFee";
|
|
276
|
+
readonly outputs: readonly [{
|
|
277
|
+
readonly internalType: "uint256";
|
|
278
|
+
readonly name: "";
|
|
279
|
+
readonly type: "uint256";
|
|
280
|
+
}];
|
|
281
|
+
readonly stateMutability: "view";
|
|
282
|
+
readonly type: "function";
|
|
283
|
+
}, {
|
|
284
|
+
readonly inputs: readonly [{
|
|
285
|
+
readonly internalType: "address";
|
|
286
|
+
readonly name: "oft_";
|
|
287
|
+
readonly type: "address";
|
|
288
|
+
}];
|
|
289
|
+
readonly name: "removeToken";
|
|
290
|
+
readonly outputs: readonly [];
|
|
291
|
+
readonly stateMutability: "nonpayable";
|
|
292
|
+
readonly type: "function";
|
|
293
|
+
}, {
|
|
294
|
+
readonly inputs: readonly [];
|
|
295
|
+
readonly name: "renounceOwnership";
|
|
296
|
+
readonly outputs: readonly [];
|
|
297
|
+
readonly stateMutability: "nonpayable";
|
|
298
|
+
readonly type: "function";
|
|
299
|
+
}, {
|
|
300
|
+
readonly inputs: readonly [{
|
|
301
|
+
readonly internalType: "address";
|
|
302
|
+
readonly name: "tokenAddress_";
|
|
303
|
+
readonly type: "address";
|
|
304
|
+
}, {
|
|
305
|
+
readonly internalType: "uint256";
|
|
306
|
+
readonly name: "adminFeeShareBP_";
|
|
307
|
+
readonly type: "uint256";
|
|
308
|
+
}];
|
|
309
|
+
readonly name: "setAdminFeeShare";
|
|
310
|
+
readonly outputs: readonly [];
|
|
311
|
+
readonly stateMutability: "nonpayable";
|
|
312
|
+
readonly type: "function";
|
|
313
|
+
}, {
|
|
314
|
+
readonly inputs: readonly [{
|
|
315
|
+
readonly internalType: "uint256";
|
|
316
|
+
readonly name: "chainId_";
|
|
317
|
+
readonly type: "uint256";
|
|
318
|
+
}, {
|
|
319
|
+
readonly internalType: "uint128";
|
|
320
|
+
readonly name: "lzGasLimit_";
|
|
321
|
+
readonly type: "uint128";
|
|
322
|
+
}];
|
|
323
|
+
readonly name: "setLzGasLimit";
|
|
324
|
+
readonly outputs: readonly [];
|
|
325
|
+
readonly stateMutability: "nonpayable";
|
|
326
|
+
readonly type: "function";
|
|
327
|
+
}, {
|
|
328
|
+
readonly inputs: readonly [{
|
|
329
|
+
readonly internalType: "uint256";
|
|
330
|
+
readonly name: "chainId_";
|
|
331
|
+
readonly type: "uint256";
|
|
332
|
+
}, {
|
|
333
|
+
readonly internalType: "uint256";
|
|
334
|
+
readonly name: "maxExtraGas_";
|
|
335
|
+
readonly type: "uint256";
|
|
336
|
+
}];
|
|
337
|
+
readonly name: "setMaxExtraGas";
|
|
338
|
+
readonly outputs: readonly [];
|
|
339
|
+
readonly stateMutability: "nonpayable";
|
|
340
|
+
readonly type: "function";
|
|
341
|
+
}, {
|
|
342
|
+
readonly inputs: readonly [{
|
|
343
|
+
readonly internalType: "address";
|
|
344
|
+
readonly name: "newOwner";
|
|
345
|
+
readonly type: "address";
|
|
346
|
+
}];
|
|
347
|
+
readonly name: "transferOwnership";
|
|
348
|
+
readonly outputs: readonly [];
|
|
349
|
+
readonly stateMutability: "nonpayable";
|
|
350
|
+
readonly type: "function";
|
|
351
|
+
}, {
|
|
352
|
+
readonly inputs: readonly [{
|
|
353
|
+
readonly internalType: "uint256";
|
|
354
|
+
readonly name: "chainId_";
|
|
355
|
+
readonly type: "uint256";
|
|
356
|
+
}];
|
|
357
|
+
readonly name: "unregisterBridgeDestination";
|
|
358
|
+
readonly outputs: readonly [];
|
|
359
|
+
readonly stateMutability: "nonpayable";
|
|
360
|
+
readonly type: "function";
|
|
361
|
+
}, {
|
|
362
|
+
readonly inputs: readonly [{
|
|
363
|
+
readonly internalType: "contract IERC20";
|
|
364
|
+
readonly name: "token_";
|
|
365
|
+
readonly type: "address";
|
|
366
|
+
}];
|
|
367
|
+
readonly name: "withdrawFeeInTokens";
|
|
368
|
+
readonly outputs: readonly [];
|
|
369
|
+
readonly stateMutability: "nonpayable";
|
|
370
|
+
readonly type: "function";
|
|
371
|
+
}, {
|
|
372
|
+
readonly inputs: readonly [{
|
|
373
|
+
readonly internalType: "uint256";
|
|
374
|
+
readonly name: "amount_";
|
|
375
|
+
readonly type: "uint256";
|
|
376
|
+
}];
|
|
377
|
+
readonly name: "withdrawGas";
|
|
378
|
+
readonly outputs: readonly [];
|
|
379
|
+
readonly stateMutability: "nonpayable";
|
|
380
|
+
readonly type: "function";
|
|
381
|
+
}, {
|
|
382
|
+
readonly stateMutability: "payable";
|
|
383
|
+
readonly type: "receive";
|
|
384
|
+
}];
|
|
385
|
+
};
|
|
386
|
+
export default artifact;
|