@across-protocol/sdk 4.3.138 → 4.3.139-alpha.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/dist/cjs/src/arch/evm/UpgradeUtils.d.ts +2 -0
- package/dist/cjs/src/arch/evm/UpgradeUtils.js +33 -0
- package/dist/cjs/src/arch/evm/UpgradeUtils.js.map +1 -0
- package/dist/cjs/src/arch/evm/index.d.ts +1 -0
- package/dist/cjs/src/arch/evm/index.js +1 -0
- package/dist/cjs/src/arch/evm/index.js.map +1 -1
- package/dist/cjs/src/arch/index.d.ts +1 -0
- package/dist/cjs/src/arch/index.js +2 -1
- package/dist/cjs/src/arch/index.js.map +1 -1
- package/dist/cjs/src/arch/tvm/BlockUtils.d.ts +1 -0
- package/dist/cjs/src/arch/tvm/BlockUtils.js +7 -0
- package/dist/cjs/src/arch/tvm/BlockUtils.js.map +1 -0
- package/dist/cjs/src/arch/tvm/MessageUtils.d.ts +1 -0
- package/dist/cjs/src/arch/tvm/MessageUtils.js +5 -0
- package/dist/cjs/src/arch/tvm/MessageUtils.js.map +1 -0
- package/dist/cjs/src/arch/tvm/ResourceUtils.d.ts +14 -0
- package/dist/cjs/src/arch/tvm/ResourceUtils.js +69 -0
- package/dist/cjs/src/arch/tvm/ResourceUtils.js.map +1 -0
- package/dist/cjs/src/arch/tvm/SpokeUtils.d.ts +12 -0
- package/dist/cjs/src/arch/tvm/SpokeUtils.js +207 -0
- package/dist/cjs/src/arch/tvm/SpokeUtils.js.map +1 -0
- package/dist/cjs/src/arch/tvm/TransactionUtils.d.ts +7 -0
- package/dist/cjs/src/arch/tvm/TransactionUtils.js +45 -0
- package/dist/cjs/src/arch/tvm/TransactionUtils.js.map +1 -0
- package/dist/cjs/src/arch/tvm/index.d.ts +6 -0
- package/dist/cjs/src/arch/tvm/index.js +10 -0
- package/dist/cjs/src/arch/tvm/index.js.map +1 -0
- package/dist/cjs/src/arch/tvm/types.d.ts +2 -0
- package/dist/cjs/src/arch/tvm/types.js +3 -0
- package/dist/cjs/src/arch/tvm/types.js.map +1 -0
- package/dist/cjs/src/arch/tvm/utils/address.d.ts +3 -0
- package/dist/cjs/src/arch/tvm/utils/address.js +17 -0
- package/dist/cjs/src/arch/tvm/utils/address.js.map +1 -0
- package/dist/cjs/src/arch/tvm/utils/index.d.ts +2 -0
- package/dist/cjs/src/arch/tvm/utils/index.js +6 -0
- package/dist/cjs/src/arch/tvm/utils/index.js.map +1 -0
- package/dist/cjs/src/arch/tvm/utils/wait.d.ts +1 -0
- package/dist/cjs/src/{caching/IPFS/index.js → arch/tvm/utils/wait.js} +2 -2
- package/dist/cjs/src/arch/tvm/utils/wait.js.map +1 -0
- package/dist/cjs/src/caching/index.d.ts +0 -1
- package/dist/cjs/src/caching/index.js +0 -1
- package/dist/cjs/src/caching/index.js.map +1 -1
- package/dist/cjs/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +9 -2
- package/dist/cjs/src/clients/SpokePoolClient/EVMSpokePoolClient.js +33 -12
- package/dist/cjs/src/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/src/clients/SpokePoolClient/TVMSpokePoolClient.d.ts +11 -0
- package/dist/cjs/src/clients/SpokePoolClient/TVMSpokePoolClient.js +47 -0
- package/dist/cjs/src/clients/SpokePoolClient/TVMSpokePoolClient.js.map +1 -0
- package/dist/cjs/src/clients/SpokePoolClient/index.d.ts +3 -0
- package/dist/cjs/src/clients/SpokePoolClient/index.js +7 -1
- package/dist/cjs/src/clients/SpokePoolClient/index.js.map +1 -1
- package/dist/cjs/src/clients/SpokePoolClient/types.d.ts +1 -0
- package/dist/cjs/src/clients/SpokePoolClient/types.js +2 -1
- package/dist/cjs/src/clients/SpokePoolClient/types.js.map +1 -1
- package/dist/cjs/src/clients/index.d.ts +1 -1
- package/dist/cjs/src/clients/index.js +3 -1
- package/dist/cjs/src/clients/index.js.map +1 -1
- package/dist/cjs/src/gasPriceOracle/oracle.js +1 -0
- package/dist/cjs/src/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/src/relayFeeCalculator/chain-queries/factory.d.ts +79 -151
- package/dist/cjs/src/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/cjs/src/relayFeeCalculator/relayFeeCalculator.d.ts +77 -150
- package/dist/cjs/src/utils/AddressUtils.d.ts +11 -0
- package/dist/cjs/src/utils/AddressUtils.js +52 -1
- package/dist/cjs/src/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/src/utils/Multicall.js +1 -0
- package/dist/cjs/src/utils/Multicall.js.map +1 -1
- package/dist/cjs/src/utils/NetworkUtils.d.ts +1 -0
- package/dist/cjs/src/utils/NetworkUtils.js +9 -3
- package/dist/cjs/src/utils/NetworkUtils.js.map +1 -1
- package/dist/cjs/src/utils/TokenUtils.d.ts +154 -300
- package/dist/cjs/src/utils/TypeGuards.d.ts +3 -1
- package/dist/cjs/src/utils/TypeGuards.js +5 -0
- package/dist/cjs/src/utils/TypeGuards.js.map +1 -1
- package/dist/cjs/src/utils/abi/typechain/SP1AutoVerifier.d.ts +42 -0
- package/dist/cjs/src/utils/abi/typechain/SP1AutoVerifier.js +3 -0
- package/dist/cjs/src/utils/abi/typechain/SP1AutoVerifier.js.map +1 -0
- package/dist/cjs/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts +26 -0
- package/dist/cjs/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js +43 -0
- package/dist/cjs/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js.map +1 -0
- package/dist/cjs/src/utils/abi/typechain/factories/index.d.ts +1 -0
- package/dist/cjs/src/utils/abi/typechain/factories/index.js +4 -2
- package/dist/cjs/src/utils/abi/typechain/factories/index.js.map +1 -1
- package/dist/cjs/src/utils/abi/typechain/index.d.ts +2 -0
- package/dist/cjs/src/utils/abi/typechain/index.js +4 -2
- package/dist/cjs/src/utils/abi/typechain/index.js.map +1 -1
- package/dist/cjs/src/utils/index.d.ts +0 -1
- package/dist/cjs/src/utils/index.js +0 -1
- package/dist/cjs/src/utils/index.js.map +1 -1
- package/dist/esm/src/arch/evm/UpgradeUtils.d.ts +9 -0
- package/dist/esm/src/arch/evm/UpgradeUtils.js +37 -0
- package/dist/esm/src/arch/evm/UpgradeUtils.js.map +1 -0
- package/dist/esm/src/arch/evm/index.d.ts +1 -0
- package/dist/esm/src/arch/evm/index.js +1 -0
- package/dist/esm/src/arch/evm/index.js.map +1 -1
- package/dist/esm/src/arch/index.d.ts +1 -0
- package/dist/esm/src/arch/index.js +2 -0
- package/dist/esm/src/arch/index.js.map +1 -1
- package/dist/esm/src/arch/tvm/BlockUtils.d.ts +1 -0
- package/dist/esm/src/arch/tvm/BlockUtils.js +2 -0
- package/dist/esm/src/arch/tvm/BlockUtils.js.map +1 -0
- package/dist/esm/src/arch/tvm/MessageUtils.d.ts +1 -0
- package/dist/esm/src/arch/tvm/MessageUtils.js +2 -0
- package/dist/esm/src/arch/tvm/MessageUtils.js.map +1 -0
- package/dist/esm/src/arch/tvm/ResourceUtils.d.ts +32 -0
- package/dist/esm/src/arch/tvm/ResourceUtils.js +88 -0
- package/dist/esm/src/arch/tvm/ResourceUtils.js.map +1 -0
- package/dist/esm/src/arch/tvm/SpokeUtils.d.ts +48 -0
- package/dist/esm/src/arch/tvm/SpokeUtils.js +237 -0
- package/dist/esm/src/arch/tvm/SpokeUtils.js.map +1 -0
- package/dist/esm/src/arch/tvm/TransactionUtils.d.ts +20 -0
- package/dist/esm/src/arch/tvm/TransactionUtils.js +57 -0
- package/dist/esm/src/arch/tvm/TransactionUtils.js.map +1 -0
- package/dist/esm/src/arch/tvm/index.d.ts +6 -0
- package/dist/esm/src/arch/tvm/index.js +7 -0
- package/dist/esm/src/arch/tvm/index.js.map +1 -0
- package/dist/esm/src/arch/tvm/types.d.ts +2 -0
- package/dist/esm/src/arch/tvm/types.js +2 -0
- package/dist/esm/src/arch/tvm/types.js.map +1 -0
- package/dist/esm/src/arch/tvm/utils/address.d.ts +18 -0
- package/dist/esm/src/arch/tvm/utils/address.js +31 -0
- package/dist/esm/src/arch/tvm/utils/address.js.map +1 -0
- package/dist/esm/src/arch/tvm/utils/index.d.ts +2 -0
- package/dist/esm/src/arch/tvm/utils/index.js +3 -0
- package/dist/esm/src/arch/tvm/utils/index.js.map +1 -0
- package/dist/esm/src/arch/tvm/utils/wait.d.ts +1 -0
- package/dist/esm/src/arch/tvm/utils/wait.js +2 -0
- package/dist/esm/src/arch/tvm/utils/wait.js.map +1 -0
- package/dist/esm/src/caching/index.d.ts +0 -1
- package/dist/esm/src/caching/index.js +0 -1
- package/dist/esm/src/caching/index.js.map +1 -1
- package/dist/esm/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +20 -2
- package/dist/esm/src/clients/SpokePoolClient/EVMSpokePoolClient.js +44 -12
- package/dist/esm/src/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/src/clients/SpokePoolClient/TVMSpokePoolClient.d.ts +32 -0
- package/dist/esm/src/clients/SpokePoolClient/TVMSpokePoolClient.js +66 -0
- package/dist/esm/src/clients/SpokePoolClient/TVMSpokePoolClient.js.map +1 -0
- package/dist/esm/src/clients/SpokePoolClient/index.d.ts +8 -0
- package/dist/esm/src/clients/SpokePoolClient/index.js +10 -1
- package/dist/esm/src/clients/SpokePoolClient/index.js.map +1 -1
- package/dist/esm/src/clients/SpokePoolClient/types.d.ts +1 -0
- package/dist/esm/src/clients/SpokePoolClient/types.js +1 -0
- package/dist/esm/src/clients/SpokePoolClient/types.js.map +1 -1
- package/dist/esm/src/clients/index.d.ts +1 -1
- package/dist/esm/src/clients/index.js +1 -1
- package/dist/esm/src/clients/index.js.map +1 -1
- package/dist/esm/src/gasPriceOracle/oracle.js +1 -0
- package/dist/esm/src/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/factory.d.ts +79 -151
- package/dist/esm/src/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/esm/src/relayFeeCalculator/relayFeeCalculator.d.ts +77 -150
- package/dist/esm/src/utils/AddressUtils.d.ts +11 -0
- package/dist/esm/src/utils/AddressUtils.js +59 -1
- package/dist/esm/src/utils/AddressUtils.js.map +1 -1
- package/dist/esm/src/utils/Multicall.js +1 -0
- package/dist/esm/src/utils/Multicall.js.map +1 -1
- package/dist/esm/src/utils/NetworkUtils.d.ts +6 -0
- package/dist/esm/src/utils/NetworkUtils.js +13 -3
- package/dist/esm/src/utils/NetworkUtils.js.map +1 -1
- package/dist/esm/src/utils/TokenUtils.d.ts +154 -300
- package/dist/esm/src/utils/TypeGuards.d.ts +3 -1
- package/dist/esm/src/utils/TypeGuards.js +4 -0
- package/dist/esm/src/utils/TypeGuards.js.map +1 -1
- package/dist/esm/src/utils/abi/typechain/SP1AutoVerifier.d.ts +42 -0
- package/dist/esm/src/utils/abi/typechain/SP1AutoVerifier.js +2 -0
- package/dist/esm/src/utils/abi/typechain/SP1AutoVerifier.js.map +1 -0
- package/dist/esm/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts +26 -0
- package/dist/esm/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js +43 -0
- package/dist/esm/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.js.map +1 -0
- package/dist/esm/src/utils/abi/typechain/factories/index.d.ts +1 -0
- package/dist/esm/src/utils/abi/typechain/factories/index.js +1 -0
- package/dist/esm/src/utils/abi/typechain/factories/index.js.map +1 -1
- package/dist/esm/src/utils/abi/typechain/index.d.ts +2 -0
- package/dist/esm/src/utils/abi/typechain/index.js +1 -0
- package/dist/esm/src/utils/abi/typechain/index.js.map +1 -1
- package/dist/esm/src/utils/index.d.ts +0 -1
- package/dist/esm/src/utils/index.js +0 -1
- package/dist/esm/src/utils/index.js.map +1 -1
- package/dist/types/src/arch/evm/UpgradeUtils.d.ts +10 -0
- package/dist/types/src/arch/evm/UpgradeUtils.d.ts.map +1 -0
- package/dist/types/src/arch/evm/index.d.ts +1 -0
- package/dist/types/src/arch/evm/index.d.ts.map +1 -1
- package/dist/types/src/arch/index.d.ts +1 -0
- package/dist/types/src/arch/index.d.ts.map +1 -1
- package/dist/types/src/arch/tvm/BlockUtils.d.ts +2 -0
- package/dist/types/src/arch/tvm/BlockUtils.d.ts.map +1 -0
- package/dist/types/src/arch/tvm/MessageUtils.d.ts +2 -0
- package/dist/types/src/arch/tvm/MessageUtils.d.ts.map +1 -0
- package/dist/types/src/arch/tvm/ResourceUtils.d.ts +33 -0
- package/dist/types/src/arch/tvm/ResourceUtils.d.ts.map +1 -0
- package/dist/types/src/arch/tvm/SpokeUtils.d.ts +49 -0
- package/dist/types/src/arch/tvm/SpokeUtils.d.ts.map +1 -0
- package/dist/types/src/arch/tvm/TransactionUtils.d.ts +21 -0
- package/dist/types/src/arch/tvm/TransactionUtils.d.ts.map +1 -0
- package/dist/types/src/arch/tvm/index.d.ts +7 -0
- package/dist/types/src/arch/tvm/index.d.ts.map +1 -0
- package/dist/types/src/arch/tvm/types.d.ts +3 -0
- package/dist/types/src/arch/tvm/types.d.ts.map +1 -0
- package/dist/types/src/arch/tvm/utils/address.d.ts +19 -0
- package/dist/types/src/arch/tvm/utils/address.d.ts.map +1 -0
- package/dist/types/src/arch/tvm/utils/index.d.ts +3 -0
- package/dist/types/src/arch/tvm/utils/index.d.ts.map +1 -0
- package/dist/types/src/arch/tvm/utils/wait.d.ts +2 -0
- package/dist/types/src/arch/tvm/utils/wait.d.ts.map +1 -0
- package/dist/types/src/caching/index.d.ts +0 -1
- package/dist/types/src/caching/index.d.ts.map +1 -1
- package/dist/types/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts +20 -2
- package/dist/types/src/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/src/clients/SpokePoolClient/TVMSpokePoolClient.d.ts +33 -0
- package/dist/types/src/clients/SpokePoolClient/TVMSpokePoolClient.d.ts.map +1 -0
- package/dist/types/src/clients/SpokePoolClient/index.d.ts +8 -0
- package/dist/types/src/clients/SpokePoolClient/index.d.ts.map +1 -1
- package/dist/types/src/clients/SpokePoolClient/types.d.ts +1 -0
- package/dist/types/src/clients/SpokePoolClient/types.d.ts.map +1 -1
- package/dist/types/src/clients/index.d.ts +1 -1
- package/dist/types/src/clients/index.d.ts.map +1 -1
- package/dist/types/src/relayFeeCalculator/chain-queries/factory.d.ts +79 -151
- package/dist/types/src/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/src/relayFeeCalculator/relayFeeCalculator.d.ts +77 -150
- package/dist/types/src/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/src/utils/AddressUtils.d.ts +11 -0
- package/dist/types/src/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/src/utils/Multicall.d.ts.map +1 -1
- package/dist/types/src/utils/NetworkUtils.d.ts +6 -0
- package/dist/types/src/utils/NetworkUtils.d.ts.map +1 -1
- package/dist/types/src/utils/TokenUtils.d.ts +154 -300
- package/dist/types/src/utils/TokenUtils.d.ts.map +1 -1
- package/dist/types/src/utils/TypeGuards.d.ts +3 -1
- package/dist/types/src/utils/TypeGuards.d.ts.map +1 -1
- package/dist/types/src/utils/abi/typechain/SP1AutoVerifier.d.ts +43 -0
- package/dist/types/src/utils/abi/typechain/SP1AutoVerifier.d.ts.map +1 -0
- package/dist/types/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts +27 -0
- package/dist/types/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.d.ts.map +1 -0
- package/dist/types/src/utils/abi/typechain/factories/index.d.ts +1 -0
- package/dist/types/src/utils/abi/typechain/factories/index.d.ts.map +1 -1
- package/dist/types/src/utils/abi/typechain/index.d.ts +2 -0
- package/dist/types/src/utils/abi/typechain/index.d.ts.map +1 -1
- package/dist/types/src/utils/index.d.ts +0 -1
- package/dist/types/src/utils/index.d.ts.map +1 -1
- package/package.json +10 -35
- package/src/arch/evm/UpgradeUtils.ts +18 -0
- package/src/arch/evm/index.ts +1 -0
- package/src/arch/index.ts +1 -0
- package/src/arch/tvm/BlockUtils.ts +1 -0
- package/src/arch/tvm/MessageUtils.ts +1 -0
- package/src/arch/tvm/ResourceUtils.ts +92 -0
- package/src/arch/tvm/SpokeUtils.ts +225 -0
- package/src/arch/tvm/TransactionUtils.ts +64 -0
- package/src/arch/tvm/index.ts +6 -0
- package/src/arch/tvm/types.ts +2 -0
- package/src/arch/tvm/utils/address.ts +33 -0
- package/src/arch/tvm/utils/index.ts +2 -0
- package/src/arch/tvm/utils/wait.ts +1 -0
- package/src/caching/index.ts +0 -1
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +44 -18
- package/src/clients/SpokePoolClient/TVMSpokePoolClient.ts +65 -0
- package/src/clients/SpokePoolClient/index.ts +12 -1
- package/src/clients/SpokePoolClient/types.ts +1 -0
- package/src/clients/index.ts +2 -0
- package/src/gasPriceOracle/oracle.ts +1 -0
- package/src/relayFeeCalculator/chain-queries/factory.ts +2 -1
- package/src/utils/AddressUtils.ts +61 -1
- package/src/utils/Multicall.ts +1 -0
- package/src/utils/NetworkUtils.ts +13 -3
- package/src/utils/TypeGuards.ts +6 -1
- package/src/utils/abi/contracts/SP1AutoVerifier.json +25 -0
- package/src/utils/abi/typechain/SP1AutoVerifier.ts +112 -0
- package/src/utils/abi/typechain/factories/SP1AutoVerifier__factory.ts +49 -0
- package/src/utils/abi/typechain/factories/index.ts +1 -0
- package/src/utils/abi/typechain/index.ts +2 -0
- package/src/utils/index.ts +0 -1
- package/dist/cjs/src/caching/IPFS/PinataIPFSClient.d.ts +0 -11
- package/dist/cjs/src/caching/IPFS/PinataIPFSClient.js +0 -67
- package/dist/cjs/src/caching/IPFS/PinataIPFSClient.js.map +0 -1
- package/dist/cjs/src/caching/IPFS/index.d.ts +0 -1
- package/dist/cjs/src/caching/IPFS/index.js.map +0 -1
- package/dist/cjs/src/utils/IPFSUtils.d.ts +0 -4
- package/dist/cjs/src/utils/IPFSUtils.js +0 -32
- package/dist/cjs/src/utils/IPFSUtils.js.map +0 -1
- package/dist/esm/src/caching/IPFS/PinataIPFSClient.d.ts +0 -37
- package/dist/esm/src/caching/IPFS/PinataIPFSClient.js +0 -81
- package/dist/esm/src/caching/IPFS/PinataIPFSClient.js.map +0 -1
- package/dist/esm/src/caching/IPFS/index.d.ts +0 -1
- package/dist/esm/src/caching/IPFS/index.js +0 -2
- package/dist/esm/src/caching/IPFS/index.js.map +0 -1
- package/dist/esm/src/utils/IPFSUtils.d.ts +0 -24
- package/dist/esm/src/utils/IPFSUtils.js +0 -47
- package/dist/esm/src/utils/IPFSUtils.js.map +0 -1
- package/dist/types/src/caching/IPFS/PinataIPFSClient.d.ts +0 -38
- package/dist/types/src/caching/IPFS/PinataIPFSClient.d.ts.map +0 -1
- package/dist/types/src/caching/IPFS/index.d.ts +0 -2
- package/dist/types/src/caching/IPFS/index.d.ts.map +0 -1
- package/dist/types/src/utils/IPFSUtils.d.ts +0 -25
- package/dist/types/src/utils/IPFSUtils.d.ts.map +0 -1
- package/scripts/build-bigint-buffer.js +0 -49
- package/src/caching/IPFS/PinataIPFSClient.ts +0 -92
- package/src/caching/IPFS/index.ts +0 -1
- package/src/utils/IPFSUtils.ts +0 -45
package/src/utils/Multicall.ts
CHANGED
|
@@ -21,6 +21,7 @@ const MULTICALL_DEPLOYER = "0x05f32B3cC3888453ff71B01135B34FF8e41263F2";
|
|
|
21
21
|
|
|
22
22
|
const NON_DETERMINISTIC_MULTICALL_ADDRESSES = {
|
|
23
23
|
[CHAIN_IDs.LENS]: "0x6b6dEa4D80e3077D076733A04c48F63c3BA49320",
|
|
24
|
+
[CHAIN_IDs.TRON]: "0x32a4f47a74a6810bd0bf861cabab99656a75de9e", // @todo: Base58?
|
|
24
25
|
[CHAIN_IDs.ZK_SYNC]: "0xF9cda624FBC7e059355ce98a31693d299FACd963",
|
|
25
26
|
[CHAIN_IDs.LENS_SEPOLIA]: "0x8A44EDE8a6843a997bC0Cc4659e4dB1Da8f91116",
|
|
26
27
|
};
|
|
@@ -134,6 +134,15 @@ export function chainIsSvm(chainId: number): boolean {
|
|
|
134
134
|
return PUBLIC_NETWORKS[chainId]?.family === ChainFamily.SVM;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Determines whether a chain ID runs on a TVM-like execution layer (e.g. TRON).
|
|
139
|
+
* @param chainId Chain ID to evaluate.
|
|
140
|
+
* @returns True if chain corresponding to chainId has a TVM-like execution layer.
|
|
141
|
+
*/
|
|
142
|
+
export function chainIsTvm(chainId: number): boolean {
|
|
143
|
+
return PUBLIC_NETWORKS[chainId]?.family === ChainFamily.TVM;
|
|
144
|
+
}
|
|
145
|
+
|
|
137
146
|
/**
|
|
138
147
|
* Determines whether a chain ID has a native gas token.
|
|
139
148
|
* @param chainId Chain ID to evaluate.
|
|
@@ -166,13 +175,14 @@ export function chainIsOFTEnabled(chainId: number): boolean {
|
|
|
166
175
|
// This is backwards vs. CCTP logic because Across support for OFTs is limited vs. OFT deployments.
|
|
167
176
|
const oftEnabled = [
|
|
168
177
|
CHAIN_IDs.ARBITRUM,
|
|
169
|
-
CHAIN_IDs.POLYGON,
|
|
170
178
|
CHAIN_IDs.HYPEREVM,
|
|
179
|
+
CHAIN_IDs.INK,
|
|
180
|
+
CHAIN_IDs.MEGAETH,
|
|
171
181
|
CHAIN_IDs.MONAD,
|
|
172
182
|
CHAIN_IDs.PLASMA,
|
|
173
|
-
CHAIN_IDs.
|
|
183
|
+
CHAIN_IDs.POLYGON,
|
|
184
|
+
CHAIN_IDs.TRON, // tbd!!!
|
|
174
185
|
CHAIN_IDs.UNICHAIN,
|
|
175
|
-
CHAIN_IDs.INK,
|
|
176
186
|
];
|
|
177
187
|
return oftEnabled.includes(chainId) && PRODUCTION_NETWORKS[chainId]?.oftEid !== OFT_NO_EID;
|
|
178
188
|
}
|
package/src/utils/TypeGuards.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SVMProvider } from "../arch/svm/types";
|
|
2
2
|
import { EvmProvider } from "../arch/evm/types";
|
|
3
3
|
import { providers } from "ethers";
|
|
4
|
+
import { TronWeb } from "tronweb";
|
|
4
5
|
|
|
5
6
|
export function isPromiseFulfilled<T>(
|
|
6
7
|
promiseSettledResult: PromiseSettledResult<T>
|
|
@@ -18,6 +19,10 @@ export function isDefined<T>(input: T | null | undefined): input is T {
|
|
|
18
19
|
return input !== null && input !== undefined;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export function
|
|
22
|
+
export function isTvmProvider(provider: EvmProvider | SVMProvider | TronWeb): provider is TronWeb {
|
|
23
|
+
return typeof (provider as TronWeb)?.trx?.getEnergyPrices === "function";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function isEvmProvider(provider: EvmProvider | SVMProvider | TronWeb): provider is EvmProvider {
|
|
22
27
|
return provider instanceof providers.Provider;
|
|
23
28
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "function",
|
|
4
|
+
"name": "verifyProof",
|
|
5
|
+
"inputs": [
|
|
6
|
+
{
|
|
7
|
+
"name": "",
|
|
8
|
+
"type": "bytes32",
|
|
9
|
+
"internalType": "bytes32"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "",
|
|
13
|
+
"type": "bytes",
|
|
14
|
+
"internalType": "bytes"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "",
|
|
18
|
+
"type": "bytes",
|
|
19
|
+
"internalType": "bytes"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"outputs": [],
|
|
23
|
+
"stateMutability": "pure"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
import type {
|
|
5
|
+
BaseContract,
|
|
6
|
+
BigNumber,
|
|
7
|
+
BytesLike,
|
|
8
|
+
CallOverrides,
|
|
9
|
+
PopulatedTransaction,
|
|
10
|
+
Signer,
|
|
11
|
+
utils,
|
|
12
|
+
} from "ethers";
|
|
13
|
+
import type { FunctionFragment, Result } from "@ethersproject/abi";
|
|
14
|
+
import type { Listener, Provider } from "@ethersproject/providers";
|
|
15
|
+
import type {
|
|
16
|
+
TypedEventFilter,
|
|
17
|
+
TypedEvent,
|
|
18
|
+
TypedListener,
|
|
19
|
+
OnEvent,
|
|
20
|
+
} from "./common";
|
|
21
|
+
|
|
22
|
+
export interface SP1AutoVerifierInterface extends utils.Interface {
|
|
23
|
+
functions: {
|
|
24
|
+
"verifyProof(bytes32,bytes,bytes)": FunctionFragment;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
getFunction(nameOrSignatureOrTopic: "verifyProof"): FunctionFragment;
|
|
28
|
+
|
|
29
|
+
encodeFunctionData(
|
|
30
|
+
functionFragment: "verifyProof",
|
|
31
|
+
values: [BytesLike, BytesLike, BytesLike]
|
|
32
|
+
): string;
|
|
33
|
+
|
|
34
|
+
decodeFunctionResult(
|
|
35
|
+
functionFragment: "verifyProof",
|
|
36
|
+
data: BytesLike
|
|
37
|
+
): Result;
|
|
38
|
+
|
|
39
|
+
events: {};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SP1AutoVerifier extends BaseContract {
|
|
43
|
+
connect(signerOrProvider: Signer | Provider | string): this;
|
|
44
|
+
attach(addressOrName: string): this;
|
|
45
|
+
deployed(): Promise<this>;
|
|
46
|
+
|
|
47
|
+
interface: SP1AutoVerifierInterface;
|
|
48
|
+
|
|
49
|
+
queryFilter<TEvent extends TypedEvent>(
|
|
50
|
+
event: TypedEventFilter<TEvent>,
|
|
51
|
+
fromBlockOrBlockhash?: string | number | undefined,
|
|
52
|
+
toBlock?: string | number | undefined
|
|
53
|
+
): Promise<Array<TEvent>>;
|
|
54
|
+
|
|
55
|
+
listeners<TEvent extends TypedEvent>(
|
|
56
|
+
eventFilter?: TypedEventFilter<TEvent>
|
|
57
|
+
): Array<TypedListener<TEvent>>;
|
|
58
|
+
listeners(eventName?: string): Array<Listener>;
|
|
59
|
+
removeAllListeners<TEvent extends TypedEvent>(
|
|
60
|
+
eventFilter: TypedEventFilter<TEvent>
|
|
61
|
+
): this;
|
|
62
|
+
removeAllListeners(eventName?: string): this;
|
|
63
|
+
off: OnEvent<this>;
|
|
64
|
+
on: OnEvent<this>;
|
|
65
|
+
once: OnEvent<this>;
|
|
66
|
+
removeListener: OnEvent<this>;
|
|
67
|
+
|
|
68
|
+
functions: {
|
|
69
|
+
verifyProof(
|
|
70
|
+
arg0: BytesLike,
|
|
71
|
+
arg1: BytesLike,
|
|
72
|
+
arg2: BytesLike,
|
|
73
|
+
overrides?: CallOverrides
|
|
74
|
+
): Promise<[void]>;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
verifyProof(
|
|
78
|
+
arg0: BytesLike,
|
|
79
|
+
arg1: BytesLike,
|
|
80
|
+
arg2: BytesLike,
|
|
81
|
+
overrides?: CallOverrides
|
|
82
|
+
): Promise<void>;
|
|
83
|
+
|
|
84
|
+
callStatic: {
|
|
85
|
+
verifyProof(
|
|
86
|
+
arg0: BytesLike,
|
|
87
|
+
arg1: BytesLike,
|
|
88
|
+
arg2: BytesLike,
|
|
89
|
+
overrides?: CallOverrides
|
|
90
|
+
): Promise<void>;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
filters: {};
|
|
94
|
+
|
|
95
|
+
estimateGas: {
|
|
96
|
+
verifyProof(
|
|
97
|
+
arg0: BytesLike,
|
|
98
|
+
arg1: BytesLike,
|
|
99
|
+
arg2: BytesLike,
|
|
100
|
+
overrides?: CallOverrides
|
|
101
|
+
): Promise<BigNumber>;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
populateTransaction: {
|
|
105
|
+
verifyProof(
|
|
106
|
+
arg0: BytesLike,
|
|
107
|
+
arg1: BytesLike,
|
|
108
|
+
arg2: BytesLike,
|
|
109
|
+
overrides?: CallOverrides
|
|
110
|
+
): Promise<PopulatedTransaction>;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import { Contract, Signer, utils } from "ethers";
|
|
6
|
+
import type { Provider } from "@ethersproject/providers";
|
|
7
|
+
import type {
|
|
8
|
+
SP1AutoVerifier,
|
|
9
|
+
SP1AutoVerifierInterface,
|
|
10
|
+
} from "../SP1AutoVerifier";
|
|
11
|
+
|
|
12
|
+
const _abi = [
|
|
13
|
+
{
|
|
14
|
+
type: "function",
|
|
15
|
+
name: "verifyProof",
|
|
16
|
+
inputs: [
|
|
17
|
+
{
|
|
18
|
+
name: "",
|
|
19
|
+
type: "bytes32",
|
|
20
|
+
internalType: "bytes32",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "",
|
|
24
|
+
type: "bytes",
|
|
25
|
+
internalType: "bytes",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "",
|
|
29
|
+
type: "bytes",
|
|
30
|
+
internalType: "bytes",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
outputs: [],
|
|
34
|
+
stateMutability: "pure",
|
|
35
|
+
},
|
|
36
|
+
] as const;
|
|
37
|
+
|
|
38
|
+
export class SP1AutoVerifier__factory {
|
|
39
|
+
static readonly abi = _abi;
|
|
40
|
+
static createInterface(): SP1AutoVerifierInterface {
|
|
41
|
+
return new utils.Interface(_abi) as SP1AutoVerifierInterface;
|
|
42
|
+
}
|
|
43
|
+
static connect(
|
|
44
|
+
address: string,
|
|
45
|
+
signerOrProvider: Signer | Provider
|
|
46
|
+
): SP1AutoVerifier {
|
|
47
|
+
return new Contract(address, _abi, signerOrProvider) as SP1AutoVerifier;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -254,6 +254,7 @@ export { ProxyAdmin__factory } from "./ProxyAdmin__factory";
|
|
|
254
254
|
export { ReentrancyGuard__factory } from "./ReentrancyGuard__factory";
|
|
255
255
|
export { ReentrancyGuardUpgradeable__factory } from "./ReentrancyGuardUpgradeable__factory";
|
|
256
256
|
export { Router_Adapter__factory } from "./Router_Adapter__factory";
|
|
257
|
+
export { SP1AutoVerifier__factory } from "./SP1AutoVerifier__factory";
|
|
257
258
|
export { SP1Helios__factory } from "./SP1Helios__factory";
|
|
258
259
|
export { SafeCast__factory } from "./SafeCast__factory";
|
|
259
260
|
export { SafeERC20__factory } from "./SafeERC20__factory";
|
|
@@ -254,6 +254,7 @@ export type { ProxyAdmin } from "./ProxyAdmin";
|
|
|
254
254
|
export type { ReentrancyGuard } from "./ReentrancyGuard";
|
|
255
255
|
export type { ReentrancyGuardUpgradeable } from "./ReentrancyGuardUpgradeable";
|
|
256
256
|
export type { Router_Adapter } from "./Router_Adapter";
|
|
257
|
+
export type { SP1AutoVerifier } from "./SP1AutoVerifier";
|
|
257
258
|
export type { SP1Helios } from "./SP1Helios";
|
|
258
259
|
export type { SafeCast } from "./SafeCast";
|
|
259
260
|
export type { SafeERC20 } from "./SafeERC20";
|
|
@@ -572,6 +573,7 @@ export { ShortStrings__factory } from "./factories/ShortStrings__factory";
|
|
|
572
573
|
export { SimpleContract__factory } from "./factories/SimpleContract__factory";
|
|
573
574
|
export { SkinnyOptimisticOracleInterface__factory } from "./factories/SkinnyOptimisticOracleInterface__factory";
|
|
574
575
|
export { Solana_Adapter__factory } from "./factories/Solana_Adapter__factory";
|
|
576
|
+
export { SP1AutoVerifier__factory } from "./factories/SP1AutoVerifier__factory";
|
|
575
577
|
export { SP1Helios__factory } from "./factories/SP1Helios__factory";
|
|
576
578
|
export { SpokePool__factory } from "./factories/SpokePool__factory";
|
|
577
579
|
export { SpokePoolEIP7702Test__factory } from "./factories/SpokePoolEIP7702Test__factory";
|
package/src/utils/index.ts
CHANGED
|
@@ -12,7 +12,6 @@ export * from "./TokenUtils";
|
|
|
12
12
|
export * from "./LogUtils";
|
|
13
13
|
export * from "./BundleUtils";
|
|
14
14
|
export * from "./JSONUtils";
|
|
15
|
-
export * from "./IPFSUtils";
|
|
16
15
|
export * from "./NumberUtils";
|
|
17
16
|
export * from "./DeploymentUtils";
|
|
18
17
|
export * from "./FormattingUtils";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CachingMechanismInterface } from "../../interfaces";
|
|
2
|
-
import { Struct } from "superstruct";
|
|
3
|
-
import winston from "winston";
|
|
4
|
-
export declare class PinataIPFSClient implements CachingMechanismInterface {
|
|
5
|
-
private client;
|
|
6
|
-
private publicGatewayURL;
|
|
7
|
-
private logger?;
|
|
8
|
-
constructor(projectId: string, projectSecret: string, publicGatewayURL: string, logger?: winston.Logger);
|
|
9
|
-
get<ObjectType>(key?: string, _structValidator?: Struct<unknown, unknown>): Promise<ObjectType | null>;
|
|
10
|
-
set<T>(key: string, value: T): Promise<string | undefined>;
|
|
11
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PinataIPFSClient = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var IPFSUtils_1 = require("../../utils/IPFSUtils");
|
|
6
|
-
var utils_1 = require("../../utils");
|
|
7
|
-
var PinataIPFSClient = (function () {
|
|
8
|
-
function PinataIPFSClient(projectId, projectSecret, publicGatewayURL, logger) {
|
|
9
|
-
this.client = (0, IPFSUtils_1.buildIPFSClient)(projectId, projectSecret);
|
|
10
|
-
this.publicGatewayURL = publicGatewayURL;
|
|
11
|
-
this.logger = logger;
|
|
12
|
-
}
|
|
13
|
-
PinataIPFSClient.prototype.get = function (key, _structValidator) {
|
|
14
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
15
|
-
var arrivedResult, revivedResult;
|
|
16
|
-
return tslib_1.__generator(this, function (_a) {
|
|
17
|
-
switch (_a.label) {
|
|
18
|
-
case 0:
|
|
19
|
-
if (!key) {
|
|
20
|
-
return [2, null];
|
|
21
|
-
}
|
|
22
|
-
(0, utils_1.formattedLog)(this.logger, {
|
|
23
|
-
level: "debug",
|
|
24
|
-
message: "Retrieving value from IPFS with key ".concat(key),
|
|
25
|
-
at: {
|
|
26
|
-
location: "IPFSClient",
|
|
27
|
-
function: "get",
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
return [4, (0, IPFSUtils_1.retrieveValueFromIPFS)(key, this.publicGatewayURL)];
|
|
31
|
-
case 1:
|
|
32
|
-
arrivedResult = _a.sent();
|
|
33
|
-
if (!arrivedResult) {
|
|
34
|
-
return [2, null];
|
|
35
|
-
}
|
|
36
|
-
revivedResult = JSON.parse(arrivedResult, utils_1.jsonReviverWithBigNumbers);
|
|
37
|
-
if (_structValidator && !_structValidator.is(revivedResult)) {
|
|
38
|
-
(0, utils_1.formattedLog)(this.logger, {
|
|
39
|
-
level: "warn",
|
|
40
|
-
message: "Retrieved value from IPFS with key ".concat(key, " does not match the expected type"),
|
|
41
|
-
at: {
|
|
42
|
-
location: "IPFSClient",
|
|
43
|
-
function: "get",
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
return [2, null];
|
|
47
|
-
}
|
|
48
|
-
return [2, revivedResult];
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
PinataIPFSClient.prototype.set = function (key, value) {
|
|
54
|
-
(0, utils_1.formattedLog)(this.logger, {
|
|
55
|
-
level: "debug",
|
|
56
|
-
message: "Setting value from IPFS with key ".concat(key),
|
|
57
|
-
at: {
|
|
58
|
-
location: "IPFSClient",
|
|
59
|
-
function: "setWithReturnID",
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
return (0, IPFSUtils_1.storeValueInIPFS)(key, JSON.stringify(value, utils_1.jsonReplacerWithBigNumbers), this.client);
|
|
63
|
-
};
|
|
64
|
-
return PinataIPFSClient;
|
|
65
|
-
}());
|
|
66
|
-
exports.PinataIPFSClient = PinataIPFSClient;
|
|
67
|
-
//# sourceMappingURL=PinataIPFSClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PinataIPFSClient.js","sourceRoot":"","sources":["../../../../../src/caching/IPFS/PinataIPFSClient.ts"],"names":[],"mappings":";;;;AAAA,mDAAiG;AAKjG,qCAAkG;AAOlG;IAgBE,0BAAmB,SAAiB,EAAE,aAAqB,EAAE,gBAAwB,EAAE,MAAuB;QAC5G,IAAI,CAAC,MAAM,GAAG,IAAA,2BAAe,EAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACxD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAQK,8BAAG,GAAT,UAAsB,GAAY,EAAE,gBAA2C;;;;;;wBAC7E,IAAI,CAAC,GAAG,EAAE,CAAC;4BACT,WAAO,IAAI,EAAC;wBACd,CAAC;wBACD,IAAA,oBAAY,EAAC,IAAI,CAAC,MAAM,EAAE;4BACxB,KAAK,EAAE,OAAO;4BACd,OAAO,EAAE,8CAAuC,GAAG,CAAE;4BACrD,EAAE,EAAE;gCACF,QAAQ,EAAE,YAAY;gCACtB,QAAQ,EAAE,KAAK;6BAChB;yBACF,CAAC,CAAC;wBAEmB,WAAM,IAAA,iCAAqB,EAAC,GAAG,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAA;;wBAAvE,aAAa,GAAG,SAAuD;wBAC7E,IAAI,CAAC,aAAa,EAAE,CAAC;4BACnB,WAAO,IAAI,EAAC;wBACd,CAAC;wBACK,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,iCAAyB,CAAC,CAAC;wBAE3E,IAAI,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;4BAC5D,IAAA,oBAAY,EAAC,IAAI,CAAC,MAAM,EAAE;gCACxB,KAAK,EAAE,MAAM;gCACb,OAAO,EAAE,6CAAsC,GAAG,sCAAmC;gCACrF,EAAE,EAAE;oCACF,QAAQ,EAAE,YAAY;oCACtB,QAAQ,EAAE,KAAK;iCAChB;6BACF,CAAC,CAAC;4BACH,WAAO,IAAI,EAAC;wBACd,CAAC;wBAED,WAAO,aAA2B,EAAC;;;;KACpC;IAQD,8BAAG,GAAH,UAAO,GAAW,EAAE,KAAQ;QAC1B,IAAA,oBAAY,EAAC,IAAI,CAAC,MAAM,EAAE;YACxB,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,2CAAoC,GAAG,CAAE;YAClD,EAAE,EAAE;gBACF,QAAQ,EAAE,YAAY;gBACtB,QAAQ,EAAE,iBAAiB;aAC5B;SACF,CAAC,CAAC;QACH,OAAO,IAAA,4BAAgB,EAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,kCAA0B,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/F,CAAC;IACH,uBAAC;AAAD,CAAC,AA/ED,IA+EC;AA/EY,4CAAgB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./PinataIPFSClient";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/caching/IPFS/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import PinataClient from "@pinata/sdk";
|
|
2
|
-
export declare function buildIPFSClient(APIKey: string, secretAPIKey: string): PinataClient;
|
|
3
|
-
export declare function retrieveValueFromIPFS(contentHash: string, publicGatewayURL: string): Promise<string>;
|
|
4
|
-
export declare function storeValueInIPFS(key: string, content: string, client: PinataClient): Promise<string>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildIPFSClient = buildIPFSClient;
|
|
4
|
-
exports.retrieveValueFromIPFS = retrieveValueFromIPFS;
|
|
5
|
-
exports.storeValueInIPFS = storeValueInIPFS;
|
|
6
|
-
var tslib_1 = require("tslib");
|
|
7
|
-
var sdk_1 = tslib_1.__importDefault(require("@pinata/sdk"));
|
|
8
|
-
var FetchUtils_1 = require("./FetchUtils");
|
|
9
|
-
function buildIPFSClient(APIKey, secretAPIKey) {
|
|
10
|
-
return new sdk_1.default(APIKey, secretAPIKey);
|
|
11
|
-
}
|
|
12
|
-
function retrieveValueFromIPFS(contentHash, publicGatewayURL) {
|
|
13
|
-
return (0, FetchUtils_1.fetchWithTimeout)("".concat(publicGatewayURL, "/ipfs/").concat(contentHash), {}, { Accept: "text/plain" }, undefined, "text");
|
|
14
|
-
}
|
|
15
|
-
function storeValueInIPFS(key, content, client) {
|
|
16
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
17
|
-
var result;
|
|
18
|
-
return tslib_1.__generator(this, function (_a) {
|
|
19
|
-
switch (_a.label) {
|
|
20
|
-
case 0: return [4, client.pinJSONToIPFS(JSON.parse(content), {
|
|
21
|
-
pinataMetadata: {
|
|
22
|
-
name: key,
|
|
23
|
-
},
|
|
24
|
-
})];
|
|
25
|
-
case 1:
|
|
26
|
-
result = _a.sent();
|
|
27
|
-
return [2, result.IpfsHash];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=IPFSUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IPFSUtils.js","sourceRoot":"","sources":["../../../../src/utils/IPFSUtils.ts"],"names":[],"mappings":";;AASA,0CAEC;AASD,sDAQC;AASD,4CAOC;;AA5CD,4DAAuC;AACvC,2CAAgD;AAQhD,SAAgB,eAAe,CAAC,MAAc,EAAE,YAAoB;IAClE,OAAO,IAAI,aAAY,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAChD,CAAC;AASD,SAAgB,qBAAqB,CAAC,WAAmB,EAAE,gBAAwB;IACjF,OAAO,IAAA,6BAAgB,EACrB,UAAG,gBAAgB,mBAAS,WAAW,CAAE,EACzC,EAAE,EACF,EAAE,MAAM,EAAE,YAAY,EAAE,EACxB,SAAS,EACT,MAAM,CACP,CAAC;AACJ,CAAC;AASD,SAAsB,gBAAgB,CAAC,GAAW,EAAE,OAAe,EAAE,MAAoB;;;;;wBACxE,WAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;wBAC7D,cAAc,EAAE;4BACd,IAAI,EAAE,GAAG;yBACV;qBACF,CAAC,EAAA;;oBAJI,MAAM,GAAG,SAIb;oBACF,WAAO,MAAM,CAAC,QAAQ,EAAC;;;;CACxB"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { CachingMechanismInterface } from "../../interfaces";
|
|
2
|
-
import { Struct } from "superstruct";
|
|
3
|
-
import winston from "winston";
|
|
4
|
-
/**
|
|
5
|
-
* A client for interacting with the IPFS. This is a wrapper around the IPFS API.
|
|
6
|
-
* This client also is a part of the caching mechanism interface.
|
|
7
|
-
* @see https://docs.ipfs.io/reference/http/api/
|
|
8
|
-
*/
|
|
9
|
-
export declare class PinataIPFSClient implements CachingMechanismInterface {
|
|
10
|
-
/**
|
|
11
|
-
* The IPFS client instance
|
|
12
|
-
*/
|
|
13
|
-
private client;
|
|
14
|
-
/**
|
|
15
|
-
* Public IPFS gateway URL to retrieve the content from
|
|
16
|
-
*/
|
|
17
|
-
private publicGatewayURL;
|
|
18
|
-
/**
|
|
19
|
-
* An optional logger for logging messages
|
|
20
|
-
*/
|
|
21
|
-
private logger?;
|
|
22
|
-
constructor(projectId: string, projectSecret: string, publicGatewayURL: string, logger?: winston.Logger);
|
|
23
|
-
/**
|
|
24
|
-
* Calls to a public IPFS gateway to retrieve a value.
|
|
25
|
-
* @param key The key to retrieve.
|
|
26
|
-
* @param _structValidator An optional struct validator to validate the retrieved value. If the value does not match the struct, null is returned.
|
|
27
|
-
* @returns The value if it exists, otherwise null.
|
|
28
|
-
*/
|
|
29
|
-
get<ObjectType>(key?: string, _structValidator?: Struct<unknown, unknown>): Promise<ObjectType | null>;
|
|
30
|
-
/**
|
|
31
|
-
* Stores a value in the IPFS and returns the CID of the value stored.
|
|
32
|
-
* @param key An optional key to store the value with. This is purely in the metadata of the CID.
|
|
33
|
-
* @param value The value to store.
|
|
34
|
-
* @returns The CID of the value stored.
|
|
35
|
-
*/
|
|
36
|
-
set<T>(key: string, value: T): Promise<string | undefined>;
|
|
37
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { __awaiter, __generator } from "tslib";
|
|
2
|
-
import { buildIPFSClient, retrieveValueFromIPFS, storeValueInIPFS } from "../../utils/IPFSUtils";
|
|
3
|
-
import { jsonReviverWithBigNumbers, jsonReplacerWithBigNumbers, formattedLog } from "../../utils";
|
|
4
|
-
/**
|
|
5
|
-
* A client for interacting with the IPFS. This is a wrapper around the IPFS API.
|
|
6
|
-
* This client also is a part of the caching mechanism interface.
|
|
7
|
-
* @see https://docs.ipfs.io/reference/http/api/
|
|
8
|
-
*/
|
|
9
|
-
var PinataIPFSClient = /** @class */ (function () {
|
|
10
|
-
function PinataIPFSClient(projectId, projectSecret, publicGatewayURL, logger) {
|
|
11
|
-
this.client = buildIPFSClient(projectId, projectSecret);
|
|
12
|
-
this.publicGatewayURL = publicGatewayURL;
|
|
13
|
-
this.logger = logger;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Calls to a public IPFS gateway to retrieve a value.
|
|
17
|
-
* @param key The key to retrieve.
|
|
18
|
-
* @param _structValidator An optional struct validator to validate the retrieved value. If the value does not match the struct, null is returned.
|
|
19
|
-
* @returns The value if it exists, otherwise null.
|
|
20
|
-
*/
|
|
21
|
-
PinataIPFSClient.prototype.get = function (key, _structValidator) {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
23
|
-
var arrivedResult, revivedResult;
|
|
24
|
-
return __generator(this, function (_a) {
|
|
25
|
-
switch (_a.label) {
|
|
26
|
-
case 0:
|
|
27
|
-
if (!key) {
|
|
28
|
-
return [2 /*return*/, null];
|
|
29
|
-
}
|
|
30
|
-
formattedLog(this.logger, {
|
|
31
|
-
level: "debug",
|
|
32
|
-
message: "Retrieving value from IPFS with key ".concat(key),
|
|
33
|
-
at: {
|
|
34
|
-
location: "IPFSClient",
|
|
35
|
-
function: "get",
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
return [4 /*yield*/, retrieveValueFromIPFS(key, this.publicGatewayURL)];
|
|
39
|
-
case 1:
|
|
40
|
-
arrivedResult = _a.sent();
|
|
41
|
-
if (!arrivedResult) {
|
|
42
|
-
return [2 /*return*/, null];
|
|
43
|
-
}
|
|
44
|
-
revivedResult = JSON.parse(arrivedResult, jsonReviverWithBigNumbers);
|
|
45
|
-
if (_structValidator && !_structValidator.is(revivedResult)) {
|
|
46
|
-
formattedLog(this.logger, {
|
|
47
|
-
level: "warn",
|
|
48
|
-
message: "Retrieved value from IPFS with key ".concat(key, " does not match the expected type"),
|
|
49
|
-
at: {
|
|
50
|
-
location: "IPFSClient",
|
|
51
|
-
function: "get",
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
return [2 /*return*/, null];
|
|
55
|
-
}
|
|
56
|
-
return [2 /*return*/, revivedResult];
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Stores a value in the IPFS and returns the CID of the value stored.
|
|
63
|
-
* @param key An optional key to store the value with. This is purely in the metadata of the CID.
|
|
64
|
-
* @param value The value to store.
|
|
65
|
-
* @returns The CID of the value stored.
|
|
66
|
-
*/
|
|
67
|
-
PinataIPFSClient.prototype.set = function (key, value) {
|
|
68
|
-
formattedLog(this.logger, {
|
|
69
|
-
level: "debug",
|
|
70
|
-
message: "Setting value from IPFS with key ".concat(key),
|
|
71
|
-
at: {
|
|
72
|
-
location: "IPFSClient",
|
|
73
|
-
function: "setWithReturnID",
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
return storeValueInIPFS(key, JSON.stringify(value, jsonReplacerWithBigNumbers), this.client);
|
|
77
|
-
};
|
|
78
|
-
return PinataIPFSClient;
|
|
79
|
-
}());
|
|
80
|
-
export { PinataIPFSClient };
|
|
81
|
-
//# sourceMappingURL=PinataIPFSClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PinataIPFSClient.js","sourceRoot":"","sources":["../../../../../src/caching/IPFS/PinataIPFSClient.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKjG,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAElG;;;;GAIG;AACH;IAgBE,0BAAmB,SAAiB,EAAE,aAAqB,EAAE,gBAAwB,EAAE,MAAuB;QAC5G,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACxD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACG,8BAAG,GAAT,UAAsB,GAAY,EAAE,gBAA2C;;;;;;wBAC7E,IAAI,CAAC,GAAG,EAAE,CAAC;4BACT,sBAAO,IAAI,EAAC;wBACd,CAAC;wBACD,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE;4BACxB,KAAK,EAAE,OAAO;4BACd,OAAO,EAAE,8CAAuC,GAAG,CAAE;4BACrD,EAAE,EAAE;gCACF,QAAQ,EAAE,YAAY;gCACtB,QAAQ,EAAE,KAAK;6BAChB;yBACF,CAAC,CAAC;wBAEmB,qBAAM,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAA;;wBAAvE,aAAa,GAAG,SAAuD;wBAC7E,IAAI,CAAC,aAAa,EAAE,CAAC;4BACnB,sBAAO,IAAI,EAAC;wBACd,CAAC;wBACK,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,yBAAyB,CAAC,CAAC;wBAE3E,IAAI,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;4BAC5D,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE;gCACxB,KAAK,EAAE,MAAM;gCACb,OAAO,EAAE,6CAAsC,GAAG,sCAAmC;gCACrF,EAAE,EAAE;oCACF,QAAQ,EAAE,YAAY;oCACtB,QAAQ,EAAE,KAAK;iCAChB;6BACF,CAAC,CAAC;4BACH,sBAAO,IAAI,EAAC;wBACd,CAAC;wBAED,sBAAO,aAA2B,EAAC;;;;KACpC;IAED;;;;;OAKG;IACH,8BAAG,GAAH,UAAO,GAAW,EAAE,KAAQ;QAC1B,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE;YACxB,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,2CAAoC,GAAG,CAAE;YAClD,EAAE,EAAE;gBACF,QAAQ,EAAE,YAAY;gBACtB,QAAQ,EAAE,iBAAiB;aAC5B;SACF,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,0BAA0B,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/F,CAAC;IACH,uBAAC;AAAD,CAAC,AA/ED,IA+EC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./PinataIPFSClient";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/caching/IPFS/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import PinataClient from "@pinata/sdk";
|
|
2
|
-
/**
|
|
3
|
-
* Build an IPFS client for interacting with the IPFS API
|
|
4
|
-
* @param APIKey The project ID
|
|
5
|
-
* @param secretAPIKey The project secret
|
|
6
|
-
* @returns An IPFS client for interacting with Pinata
|
|
7
|
-
*/
|
|
8
|
-
export declare function buildIPFSClient(APIKey: string, secretAPIKey: string): PinataClient;
|
|
9
|
-
/**
|
|
10
|
-
* Retrieves a value from an IPFS gateway
|
|
11
|
-
* @param contentHash The content hash of the value to retrieve
|
|
12
|
-
* @param publicGatewayURL The URL of the public IPFS gateway to use
|
|
13
|
-
* @returns The value retrieved from the IPFS gateway
|
|
14
|
-
* @throws Error if the value could not be retrieved
|
|
15
|
-
*/
|
|
16
|
-
export declare function retrieveValueFromIPFS(contentHash: string, publicGatewayURL: string): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Pins a value to the IPFS network
|
|
19
|
-
* @param key A key to use for pinning the value. This is a metadata field.
|
|
20
|
-
* @param content The value to pin
|
|
21
|
-
* @param client The IPFS client to use
|
|
22
|
-
* @returns The content hash of the pinned value
|
|
23
|
-
*/
|
|
24
|
-
export declare function storeValueInIPFS(key: string, content: string, client: PinataClient): Promise<string>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { __awaiter, __generator } from "tslib";
|
|
2
|
-
import PinataClient from "@pinata/sdk";
|
|
3
|
-
import { fetchWithTimeout } from "./FetchUtils";
|
|
4
|
-
/**
|
|
5
|
-
* Build an IPFS client for interacting with the IPFS API
|
|
6
|
-
* @param APIKey The project ID
|
|
7
|
-
* @param secretAPIKey The project secret
|
|
8
|
-
* @returns An IPFS client for interacting with Pinata
|
|
9
|
-
*/
|
|
10
|
-
export function buildIPFSClient(APIKey, secretAPIKey) {
|
|
11
|
-
return new PinataClient(APIKey, secretAPIKey);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Retrieves a value from an IPFS gateway
|
|
15
|
-
* @param contentHash The content hash of the value to retrieve
|
|
16
|
-
* @param publicGatewayURL The URL of the public IPFS gateway to use
|
|
17
|
-
* @returns The value retrieved from the IPFS gateway
|
|
18
|
-
* @throws Error if the value could not be retrieved
|
|
19
|
-
*/
|
|
20
|
-
export function retrieveValueFromIPFS(contentHash, publicGatewayURL) {
|
|
21
|
-
return fetchWithTimeout("".concat(publicGatewayURL, "/ipfs/").concat(contentHash), {}, { Accept: "text/plain" }, undefined, "text");
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Pins a value to the IPFS network
|
|
25
|
-
* @param key A key to use for pinning the value. This is a metadata field.
|
|
26
|
-
* @param content The value to pin
|
|
27
|
-
* @param client The IPFS client to use
|
|
28
|
-
* @returns The content hash of the pinned value
|
|
29
|
-
*/
|
|
30
|
-
export function storeValueInIPFS(key, content, client) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
32
|
-
var result;
|
|
33
|
-
return __generator(this, function (_a) {
|
|
34
|
-
switch (_a.label) {
|
|
35
|
-
case 0: return [4 /*yield*/, client.pinJSONToIPFS(JSON.parse(content), {
|
|
36
|
-
pinataMetadata: {
|
|
37
|
-
name: key,
|
|
38
|
-
},
|
|
39
|
-
})];
|
|
40
|
-
case 1:
|
|
41
|
-
result = _a.sent();
|
|
42
|
-
return [2 /*return*/, result.IpfsHash];
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=IPFSUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IPFSUtils.js","sourceRoot":"","sources":["../../../../src/utils/IPFSUtils.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc,EAAE,YAAoB;IAClE,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,WAAmB,EAAE,gBAAwB;IACjF,OAAO,gBAAgB,CACrB,UAAG,gBAAgB,mBAAS,WAAW,CAAE,EACzC,EAAE,EACF,EAAE,MAAM,EAAE,YAAY,EAAE,EACxB,SAAS,EACT,MAAM,CACP,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAgB,gBAAgB,CAAC,GAAW,EAAE,OAAe,EAAE,MAAoB;;;;;wBACxE,qBAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;wBAC7D,cAAc,EAAE;4BACd,IAAI,EAAE,GAAG;yBACV;qBACF,CAAC,EAAA;;oBAJI,MAAM,GAAG,SAIb;oBACF,sBAAO,MAAM,CAAC,QAAQ,EAAC;;;;CACxB"}
|