@across-protocol/sdk 4.3.138 → 4.3.139-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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/adapters/tron.d.ts +4 -0
- package/dist/cjs/src/gasPriceOracle/adapters/tron.js +58 -0
- package/dist/cjs/src/gasPriceOracle/adapters/tron.js.map +1 -0
- package/dist/cjs/src/gasPriceOracle/index.d.ts +1 -1
- package/dist/cjs/src/gasPriceOracle/oracle.d.ts +3 -1
- package/dist/cjs/src/gasPriceOracle/oracle.js +15 -10
- package/dist/cjs/src/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/src/gasPriceOracle/types.d.ts +6 -1
- package/dist/cjs/src/gasPriceOracle/types.js +5 -0
- package/dist/cjs/src/gasPriceOracle/types.js.map +1 -1
- package/dist/cjs/src/relayFeeCalculator/chain-queries/factory.d.ts +81 -152
- package/dist/cjs/src/relayFeeCalculator/chain-queries/factory.js +5 -0
- package/dist/cjs/src/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/cjs/src/relayFeeCalculator/chain-queries/index.d.ts +1 -0
- package/dist/cjs/src/relayFeeCalculator/chain-queries/index.js +1 -0
- package/dist/cjs/src/relayFeeCalculator/chain-queries/index.js.map +1 -1
- package/dist/cjs/src/relayFeeCalculator/chain-queries/tvmQuery.d.ts +16 -0
- package/dist/cjs/src/relayFeeCalculator/chain-queries/tvmQuery.js +52 -0
- package/dist/cjs/src/relayFeeCalculator/chain-queries/tvmQuery.js.map +1 -0
- 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/adapters/tron.d.ts +10 -0
- package/dist/esm/src/gasPriceOracle/adapters/tron.js +68 -0
- package/dist/esm/src/gasPriceOracle/adapters/tron.js.map +1 -0
- package/dist/esm/src/gasPriceOracle/index.d.ts +1 -1
- package/dist/esm/src/gasPriceOracle/oracle.d.ts +3 -1
- package/dist/esm/src/gasPriceOracle/oracle.js +17 -11
- package/dist/esm/src/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/src/gasPriceOracle/types.d.ts +6 -1
- package/dist/esm/src/gasPriceOracle/types.js +4 -0
- package/dist/esm/src/gasPriceOracle/types.js.map +1 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/factory.d.ts +81 -152
- package/dist/esm/src/relayFeeCalculator/chain-queries/factory.js +6 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/index.d.ts +1 -0
- package/dist/esm/src/relayFeeCalculator/chain-queries/index.js +1 -0
- package/dist/esm/src/relayFeeCalculator/chain-queries/index.js.map +1 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/tvmQuery.d.ts +32 -0
- package/dist/esm/src/relayFeeCalculator/chain-queries/tvmQuery.js +65 -0
- package/dist/esm/src/relayFeeCalculator/chain-queries/tvmQuery.js.map +1 -0
- 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/gasPriceOracle/adapters/tron.d.ts +11 -0
- package/dist/types/src/gasPriceOracle/adapters/tron.d.ts.map +1 -0
- package/dist/types/src/gasPriceOracle/index.d.ts +1 -1
- package/dist/types/src/gasPriceOracle/index.d.ts.map +1 -1
- package/dist/types/src/gasPriceOracle/oracle.d.ts +3 -1
- package/dist/types/src/gasPriceOracle/oracle.d.ts.map +1 -1
- package/dist/types/src/gasPriceOracle/types.d.ts +6 -1
- package/dist/types/src/gasPriceOracle/types.d.ts.map +1 -1
- package/dist/types/src/relayFeeCalculator/chain-queries/factory.d.ts +81 -152
- package/dist/types/src/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/src/relayFeeCalculator/chain-queries/index.d.ts +1 -0
- package/dist/types/src/relayFeeCalculator/chain-queries/index.d.ts.map +1 -1
- package/dist/types/src/relayFeeCalculator/chain-queries/tvmQuery.d.ts +33 -0
- package/dist/types/src/relayFeeCalculator/chain-queries/tvmQuery.d.ts.map +1 -0
- 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/adapters/tron.ts +50 -0
- package/src/gasPriceOracle/index.ts +1 -1
- package/src/gasPriceOracle/oracle.ts +23 -3
- package/src/gasPriceOracle/types.ts +11 -1
- package/src/relayFeeCalculator/chain-queries/factory.ts +18 -3
- package/src/relayFeeCalculator/chain-queries/index.ts +1 -0
- package/src/relayFeeCalculator/chain-queries/tvmQuery.ts +88 -0
- 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
|
@@ -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"}
|
|
@@ -1,38 +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
|
-
}
|
|
38
|
-
//# sourceMappingURL=PinataIPFSClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PinataIPFSClient.d.ts","sourceRoot":"","sources":["../../../../../src/caching/IPFS/PinataIPFSClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B;;;;GAIG;AACH,qBAAa,gBAAiB,YAAW,yBAAyB;IAChE;;OAEG;IACH,OAAO,CAAC,MAAM,CAAe;IAE7B;;OAEG;IACH,OAAO,CAAC,gBAAgB,CAAS;IAEjC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,CAAiB;gBAEb,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM;IAM9G;;;;;OAKG;IACG,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAkC5G;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAW3D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/caching/IPFS/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,25 +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>;
|
|
25
|
-
//# sourceMappingURL=IPFSUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IPFSUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/IPFSUtils.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AAGvC;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,YAAY,CAElF;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQpG;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAO1G"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build Script for bigint-buffer Native Module
|
|
3
|
-
*
|
|
4
|
-
* Purpose:
|
|
5
|
-
* This script handles the native compilation of the bigint-buffer module, which provides
|
|
6
|
-
* high-performance BigInt <-> Buffer conversions using native C++ code.
|
|
7
|
-
*
|
|
8
|
-
* Why JavaScript and not TypeScript or an embedded shell script:
|
|
9
|
-
* 1. This is a build script that runs during package installation (postinstall)
|
|
10
|
-
* 2. Using TypeScript would require the TypeScript compiler or ts-node to be available during installation
|
|
11
|
-
* 3. Plain JavaScript ensures this script can run immediately without compilation
|
|
12
|
-
* 4. This script is operating system agnostic, so it can be run on any platform that supports Node.js
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const { execSync } = require('child_process');
|
|
16
|
-
const { existsSync } = require('fs');
|
|
17
|
-
const path = require('path');
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
// Check if the bigint-buffer module exists in node_modules
|
|
21
|
-
// Using path.join for cross-platform compatibility (Windows/Unix)
|
|
22
|
-
const bigintBufferPath = path.join(process.cwd(), 'node_modules/bigint-buffer');
|
|
23
|
-
|
|
24
|
-
// Skip if module isn't installed
|
|
25
|
-
if (!existsSync(bigintBufferPath)) {
|
|
26
|
-
console.log('Skipping bigint-buffer build: folder not found');
|
|
27
|
-
process.exit(0);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Verify node-gyp (native module build tool) is available
|
|
31
|
-
// node-gyp is required to compile the C++ code in bigint-buffer
|
|
32
|
-
try {
|
|
33
|
-
execSync('command -v node-gyp', { stdio: 'ignore' });
|
|
34
|
-
} catch {
|
|
35
|
-
console.log('Skipping bigint-buffer build: node-gyp not found');
|
|
36
|
-
process.exit(0);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Change to the module directory and run the native build
|
|
40
|
-
// node-gyp configure: Creates platform-specific build files
|
|
41
|
-
// node-gyp build: Compiles the native code
|
|
42
|
-
process.chdir(bigintBufferPath);
|
|
43
|
-
execSync('node-gyp configure', { stdio: 'inherit' });
|
|
44
|
-
execSync('node-gyp build', { stdio: 'inherit' });
|
|
45
|
-
} catch (error) {
|
|
46
|
-
// Proper error handling for build failures
|
|
47
|
-
console.error('Error building bigint-buffer:', error);
|
|
48
|
-
process.exit(1);
|
|
49
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { buildIPFSClient, retrieveValueFromIPFS, storeValueInIPFS } from "../../utils/IPFSUtils";
|
|
2
|
-
import { CachingMechanismInterface } from "../../interfaces";
|
|
3
|
-
import { Struct } from "superstruct";
|
|
4
|
-
import winston from "winston";
|
|
5
|
-
import PinataClient from "@pinata/sdk";
|
|
6
|
-
import { jsonReviverWithBigNumbers, jsonReplacerWithBigNumbers, formattedLog } from "../../utils";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* A client for interacting with the IPFS. This is a wrapper around the IPFS API.
|
|
10
|
-
* This client also is a part of the caching mechanism interface.
|
|
11
|
-
* @see https://docs.ipfs.io/reference/http/api/
|
|
12
|
-
*/
|
|
13
|
-
export class PinataIPFSClient implements CachingMechanismInterface {
|
|
14
|
-
/**
|
|
15
|
-
* The IPFS client instance
|
|
16
|
-
*/
|
|
17
|
-
private client: PinataClient;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Public IPFS gateway URL to retrieve the content from
|
|
21
|
-
*/
|
|
22
|
-
private publicGatewayURL: string;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* An optional logger for logging messages
|
|
26
|
-
*/
|
|
27
|
-
private logger?: winston.Logger;
|
|
28
|
-
|
|
29
|
-
public constructor(projectId: string, projectSecret: string, publicGatewayURL: string, logger?: winston.Logger) {
|
|
30
|
-
this.client = buildIPFSClient(projectId, projectSecret);
|
|
31
|
-
this.publicGatewayURL = publicGatewayURL;
|
|
32
|
-
this.logger = logger;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Calls to a public IPFS gateway to retrieve a value.
|
|
37
|
-
* @param key The key to retrieve.
|
|
38
|
-
* @param _structValidator An optional struct validator to validate the retrieved value. If the value does not match the struct, null is returned.
|
|
39
|
-
* @returns The value if it exists, otherwise null.
|
|
40
|
-
*/
|
|
41
|
-
async get<ObjectType>(key?: string, _structValidator?: Struct<unknown, unknown>): Promise<ObjectType | null> {
|
|
42
|
-
if (!key) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
formattedLog(this.logger, {
|
|
46
|
-
level: "debug",
|
|
47
|
-
message: `Retrieving value from IPFS with key ${key}`,
|
|
48
|
-
at: {
|
|
49
|
-
location: "IPFSClient",
|
|
50
|
-
function: "get",
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const arrivedResult = await retrieveValueFromIPFS(key, this.publicGatewayURL);
|
|
55
|
-
if (!arrivedResult) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
const revivedResult = JSON.parse(arrivedResult, jsonReviverWithBigNumbers);
|
|
59
|
-
|
|
60
|
-
if (_structValidator && !_structValidator.is(revivedResult)) {
|
|
61
|
-
formattedLog(this.logger, {
|
|
62
|
-
level: "warn",
|
|
63
|
-
message: `Retrieved value from IPFS with key ${key} does not match the expected type`,
|
|
64
|
-
at: {
|
|
65
|
-
location: "IPFSClient",
|
|
66
|
-
function: "get",
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return revivedResult as ObjectType;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Stores a value in the IPFS and returns the CID of the value stored.
|
|
77
|
-
* @param key An optional key to store the value with. This is purely in the metadata of the CID.
|
|
78
|
-
* @param value The value to store.
|
|
79
|
-
* @returns The CID of the value stored.
|
|
80
|
-
*/
|
|
81
|
-
set<T>(key: string, value: T): Promise<string | undefined> {
|
|
82
|
-
formattedLog(this.logger, {
|
|
83
|
-
level: "debug",
|
|
84
|
-
message: `Setting value from IPFS with key ${key}`,
|
|
85
|
-
at: {
|
|
86
|
-
location: "IPFSClient",
|
|
87
|
-
function: "setWithReturnID",
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
return storeValueInIPFS(key, JSON.stringify(value, jsonReplacerWithBigNumbers), this.client);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./PinataIPFSClient";
|
package/src/utils/IPFSUtils.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import PinataClient from "@pinata/sdk";
|
|
2
|
-
import { fetchWithTimeout } from "./FetchUtils";
|
|
3
|
-
|
|
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: string, secretAPIKey: string): PinataClient {
|
|
11
|
-
return new PinataClient(APIKey, secretAPIKey);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Retrieves a value from an IPFS gateway
|
|
16
|
-
* @param contentHash The content hash of the value to retrieve
|
|
17
|
-
* @param publicGatewayURL The URL of the public IPFS gateway to use
|
|
18
|
-
* @returns The value retrieved from the IPFS gateway
|
|
19
|
-
* @throws Error if the value could not be retrieved
|
|
20
|
-
*/
|
|
21
|
-
export function retrieveValueFromIPFS(contentHash: string, publicGatewayURL: string): Promise<string> {
|
|
22
|
-
return fetchWithTimeout<string>(
|
|
23
|
-
`${publicGatewayURL}/ipfs/${contentHash}`,
|
|
24
|
-
{},
|
|
25
|
-
{ Accept: "text/plain" },
|
|
26
|
-
undefined,
|
|
27
|
-
"text"
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Pins a value to the IPFS network
|
|
33
|
-
* @param key A key to use for pinning the value. This is a metadata field.
|
|
34
|
-
* @param content The value to pin
|
|
35
|
-
* @param client The IPFS client to use
|
|
36
|
-
* @returns The content hash of the pinned value
|
|
37
|
-
*/
|
|
38
|
-
export async function storeValueInIPFS(key: string, content: string, client: PinataClient): Promise<string> {
|
|
39
|
-
const result = await client.pinJSONToIPFS(JSON.parse(content), {
|
|
40
|
-
pinataMetadata: {
|
|
41
|
-
name: key,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
return result.IpfsHash;
|
|
45
|
-
}
|