@wormhole-foundation/sdk-connect 0.5.0-beta.0
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/circle-api.d.ts +16 -0
- package/dist/cjs/circle-api.d.ts.map +1 -0
- package/dist/cjs/circle-api.js +47 -0
- package/dist/cjs/circle-api.js.map +1 -0
- package/dist/cjs/common.d.ts +4 -0
- package/dist/cjs/common.d.ts.map +1 -0
- package/dist/cjs/common.js +40 -0
- package/dist/cjs/common.js.map +1 -0
- package/dist/cjs/config.d.ts +34 -0
- package/dist/cjs/config.d.ts.map +1 -0
- package/dist/cjs/config.js +52 -0
- package/dist/cjs/config.js.map +1 -0
- package/dist/cjs/index.d.ts +15 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +45 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/protocols/cctp/cctpTransfer.d.ts +41 -0
- package/dist/cjs/protocols/cctp/cctpTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/cctp/cctpTransfer.js +459 -0
- package/dist/cjs/protocols/cctp/cctpTransfer.js.map +1 -0
- package/dist/cjs/protocols/cctp/index.d.ts +2 -0
- package/dist/cjs/protocols/cctp/index.d.ts.map +1 -0
- package/dist/cjs/protocols/cctp/index.js +18 -0
- package/dist/cjs/protocols/cctp/index.js.map +1 -0
- package/dist/cjs/protocols/cctpTransfer.d.ts +41 -0
- package/dist/cjs/protocols/cctpTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/cctpTransfer.js +459 -0
- package/dist/cjs/protocols/cctpTransfer.js.map +1 -0
- package/dist/cjs/protocols/gateway/gatewayTransfer.d.ts +38 -0
- package/dist/cjs/protocols/gateway/gatewayTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/gateway/gatewayTransfer.js +360 -0
- package/dist/cjs/protocols/gateway/gatewayTransfer.js.map +1 -0
- package/dist/cjs/protocols/gateway/index.d.ts +2 -0
- package/dist/cjs/protocols/gateway/index.d.ts.map +1 -0
- package/dist/cjs/protocols/gateway/index.js +18 -0
- package/dist/cjs/protocols/gateway/index.js.map +1 -0
- package/dist/cjs/protocols/gatewayTransfer.d.ts +40 -0
- package/dist/cjs/protocols/gatewayTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/gatewayTransfer.js +406 -0
- package/dist/cjs/protocols/gatewayTransfer.js.map +1 -0
- package/dist/cjs/protocols/index.d.ts +5 -0
- package/dist/cjs/protocols/index.d.ts.map +1 -0
- package/dist/cjs/protocols/index.js +21 -0
- package/dist/cjs/protocols/index.js.map +1 -0
- package/dist/cjs/protocols/tokenBridge/automatic.d.ts +16 -0
- package/dist/cjs/protocols/tokenBridge/automatic.d.ts.map +1 -0
- package/dist/cjs/protocols/tokenBridge/automatic.js +77 -0
- package/dist/cjs/protocols/tokenBridge/automatic.js.map +1 -0
- package/dist/cjs/protocols/tokenBridge/index.d.ts +5 -0
- package/dist/cjs/protocols/tokenBridge/index.d.ts.map +1 -0
- package/dist/cjs/protocols/tokenBridge/index.js +21 -0
- package/dist/cjs/protocols/tokenBridge/index.js.map +1 -0
- package/dist/cjs/protocols/tokenBridge/manual.d.ts +16 -0
- package/dist/cjs/protocols/tokenBridge/manual.d.ts.map +1 -0
- package/dist/cjs/protocols/tokenBridge/manual.js +77 -0
- package/dist/cjs/protocols/tokenBridge/manual.js.map +1 -0
- package/dist/cjs/protocols/tokenBridge/tokenTransfer.d.ts +20 -0
- package/dist/cjs/protocols/tokenBridge/tokenTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/tokenBridge/tokenTransfer.js +24 -0
- package/dist/cjs/protocols/tokenBridge/tokenTransfer.js.map +1 -0
- package/dist/cjs/protocols/tokenBridge/utils.d.ts +25 -0
- package/dist/cjs/protocols/tokenBridge/utils.d.ts.map +1 -0
- package/dist/cjs/protocols/tokenBridge/utils.js +331 -0
- package/dist/cjs/protocols/tokenBridge/utils.js.map +1 -0
- package/dist/cjs/protocols/tokenTransfer.d.ts +40 -0
- package/dist/cjs/protocols/tokenTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/tokenTransfer.js +472 -0
- package/dist/cjs/protocols/tokenTransfer.js.map +1 -0
- package/dist/cjs/protocols/tokenbridge/automatic.d.ts +16 -0
- package/dist/cjs/protocols/tokenbridge/automatic.d.ts.map +1 -0
- package/dist/cjs/protocols/tokenbridge/automatic.js +76 -0
- package/dist/cjs/protocols/tokenbridge/automatic.js.map +1 -0
- package/dist/cjs/protocols/tokenbridge/index.d.ts +2 -0
- package/dist/cjs/protocols/tokenbridge/index.d.ts.map +1 -0
- package/dist/cjs/protocols/tokenbridge/index.js +18 -0
- package/dist/cjs/protocols/tokenbridge/index.js.map +1 -0
- package/dist/cjs/protocols/tokenbridge/manual.d.ts +16 -0
- package/dist/cjs/protocols/tokenbridge/manual.d.ts.map +1 -0
- package/dist/cjs/protocols/tokenbridge/manual.js +76 -0
- package/dist/cjs/protocols/tokenbridge/manual.js.map +1 -0
- package/dist/cjs/protocols/tokenbridge/tokenTransfer.d.ts +37 -0
- package/dist/cjs/protocols/tokenbridge/tokenTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/tokenbridge/tokenTransfer.js +345 -0
- package/dist/cjs/protocols/tokenbridge/tokenTransfer.js.map +1 -0
- package/dist/cjs/protocols/wormholeTransfer.d.ts +20 -0
- package/dist/cjs/protocols/wormholeTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/wormholeTransfer.js +3 -0
- package/dist/cjs/protocols/wormholeTransfer.js.map +1 -0
- package/dist/cjs/quote.d.ts +17 -0
- package/dist/cjs/quote.d.ts.map +1 -0
- package/dist/cjs/quote.js +3 -0
- package/dist/cjs/quote.js.map +1 -0
- package/dist/cjs/receipt.d.ts +51 -0
- package/dist/cjs/receipt.d.ts.map +1 -0
- package/dist/cjs/receipt.js +31 -0
- package/dist/cjs/receipt.js.map +1 -0
- package/dist/cjs/routes/automaticTokenBridgeRoute.d.ts +28 -0
- package/dist/cjs/routes/automaticTokenBridgeRoute.d.ts.map +1 -0
- package/dist/cjs/routes/automaticTokenBridgeRoute.js +82 -0
- package/dist/cjs/routes/automaticTokenBridgeRoute.js.map +1 -0
- package/dist/cjs/routes/cctp/automatic.d.ts +46 -0
- package/dist/cjs/routes/cctp/automatic.d.ts.map +1 -0
- package/dist/cjs/routes/cctp/automatic.js +135 -0
- package/dist/cjs/routes/cctp/automatic.js.map +1 -0
- package/dist/cjs/routes/cctp/index.d.ts +3 -0
- package/dist/cjs/routes/cctp/index.d.ts.map +1 -0
- package/dist/cjs/routes/cctp/index.js +19 -0
- package/dist/cjs/routes/cctp/index.js.map +1 -0
- package/dist/cjs/routes/cctp/manual.d.ts +43 -0
- package/dist/cjs/routes/cctp/manual.d.ts.map +1 -0
- package/dist/cjs/routes/cctp/manual.js +113 -0
- package/dist/cjs/routes/cctp/manual.js.map +1 -0
- package/dist/cjs/routes/common.d.ts +13 -0
- package/dist/cjs/routes/common.d.ts.map +1 -0
- package/dist/cjs/routes/common.js +45 -0
- package/dist/cjs/routes/common.js.map +1 -0
- package/dist/cjs/routes/index.d.ts +9 -0
- package/dist/cjs/routes/index.d.ts.map +1 -0
- package/dist/cjs/routes/index.js +25 -0
- package/dist/cjs/routes/index.js.map +1 -0
- package/dist/cjs/routes/mock/automatic.d.ts +25 -0
- package/dist/cjs/routes/mock/automatic.d.ts.map +1 -0
- package/dist/cjs/routes/mock/automatic.js +88 -0
- package/dist/cjs/routes/mock/automatic.js.map +1 -0
- package/dist/cjs/routes/mock/index.d.ts +3 -0
- package/dist/cjs/routes/mock/index.d.ts.map +1 -0
- package/dist/cjs/routes/mock/index.js +19 -0
- package/dist/cjs/routes/mock/index.js.map +1 -0
- package/dist/cjs/routes/mock/manual.d.ts +24 -0
- package/dist/cjs/routes/mock/manual.d.ts.map +1 -0
- package/dist/cjs/routes/mock/manual.js +87 -0
- package/dist/cjs/routes/mock/manual.js.map +1 -0
- package/dist/cjs/routes/portico/automatic.d.ts +68 -0
- package/dist/cjs/routes/portico/automatic.d.ts.map +1 -0
- package/dist/cjs/routes/portico/automatic.js +208 -0
- package/dist/cjs/routes/portico/automatic.js.map +1 -0
- package/dist/cjs/routes/portico/index.d.ts +2 -0
- package/dist/cjs/routes/portico/index.d.ts.map +1 -0
- package/dist/cjs/routes/portico/index.js +18 -0
- package/dist/cjs/routes/portico/index.js.map +1 -0
- package/dist/cjs/routes/portico/manual.d.ts +61 -0
- package/dist/cjs/routes/portico/manual.d.ts.map +1 -0
- package/dist/cjs/routes/portico/manual.js +141 -0
- package/dist/cjs/routes/portico/manual.js.map +1 -0
- package/dist/cjs/routes/portico/porticoRoute.d.ts +56 -0
- package/dist/cjs/routes/portico/porticoRoute.d.ts.map +1 -0
- package/dist/cjs/routes/portico/porticoRoute.js +160 -0
- package/dist/cjs/routes/portico/porticoRoute.js.map +1 -0
- package/dist/cjs/routes/portico/protocol/abis.d.ts +4 -0
- package/dist/cjs/routes/portico/protocol/abis.d.ts.map +1 -0
- package/dist/cjs/routes/portico/protocol/abis.js +12 -0
- package/dist/cjs/routes/portico/protocol/abis.js.map +1 -0
- package/dist/cjs/routes/portico/protocol/consts.d.ts +18 -0
- package/dist/cjs/routes/portico/protocol/consts.d.ts.map +1 -0
- package/dist/cjs/routes/portico/protocol/consts.js +48 -0
- package/dist/cjs/routes/portico/protocol/consts.js.map +1 -0
- package/dist/cjs/routes/portico/protocol/porticoBridge.d.ts +17 -0
- package/dist/cjs/routes/portico/protocol/porticoBridge.d.ts.map +1 -0
- package/dist/cjs/routes/portico/protocol/porticoBridge.js +119 -0
- package/dist/cjs/routes/portico/protocol/porticoBridge.js.map +1 -0
- package/dist/cjs/routes/portico/protocol/types.d.ts +88 -0
- package/dist/cjs/routes/portico/protocol/types.d.ts.map +1 -0
- package/dist/cjs/routes/portico/protocol/types.js +3 -0
- package/dist/cjs/routes/portico/protocol/types.js.map +1 -0
- package/dist/cjs/routes/portico/protocol/utils.d.ts +18 -0
- package/dist/cjs/routes/portico/protocol/utils.d.ts.map +1 -0
- package/dist/cjs/routes/portico/protocol/utils.js +167 -0
- package/dist/cjs/routes/portico/protocol/utils.js.map +1 -0
- package/dist/cjs/routes/portico/utils.d.ts +1 -0
- package/dist/cjs/routes/portico/utils.d.ts.map +1 -0
- package/dist/cjs/routes/portico/utils.js +2 -0
- package/dist/cjs/routes/portico/utils.js.map +1 -0
- package/dist/cjs/routes/request.d.ts +25 -0
- package/dist/cjs/routes/request.d.ts.map +1 -0
- package/dist/cjs/routes/request.js +65 -0
- package/dist/cjs/routes/request.js.map +1 -0
- package/dist/cjs/routes/resolver.d.ts +15 -0
- package/dist/cjs/routes/resolver.d.ts.map +1 -0
- package/dist/cjs/routes/resolver.js +87 -0
- package/dist/cjs/routes/resolver.js.map +1 -0
- package/dist/cjs/routes/route.d.ts +46 -0
- package/dist/cjs/routes/route.d.ts.map +1 -0
- package/dist/cjs/routes/route.js +34 -0
- package/dist/cjs/routes/route.js.map +1 -0
- package/dist/cjs/routes/token.d.ts +12 -0
- package/dist/cjs/routes/token.d.ts.map +1 -0
- package/dist/cjs/routes/token.js +37 -0
- package/dist/cjs/routes/token.js.map +1 -0
- package/dist/cjs/routes/tokenBridge/automatic.d.ts +46 -0
- package/dist/cjs/routes/tokenBridge/automatic.d.ts.map +1 -0
- package/dist/cjs/routes/tokenBridge/automatic.js +145 -0
- package/dist/cjs/routes/tokenBridge/automatic.js.map +1 -0
- package/dist/cjs/routes/tokenBridge/index.d.ts +3 -0
- package/dist/cjs/routes/tokenBridge/index.d.ts.map +1 -0
- package/dist/cjs/routes/tokenBridge/index.js +19 -0
- package/dist/cjs/routes/tokenBridge/index.js.map +1 -0
- package/dist/cjs/routes/tokenBridge/manual.d.ts +42 -0
- package/dist/cjs/routes/tokenBridge/manual.d.ts.map +1 -0
- package/dist/cjs/routes/tokenBridge/manual.js +87 -0
- package/dist/cjs/routes/tokenBridge/manual.js.map +1 -0
- package/dist/cjs/routes/tokenBridgeRoute.d.ts +25 -0
- package/dist/cjs/routes/tokenBridgeRoute.d.ts.map +1 -0
- package/dist/cjs/routes/tokenBridgeRoute.js +78 -0
- package/dist/cjs/routes/tokenBridgeRoute.js.map +1 -0
- package/dist/cjs/routes/types.d.ts +44 -0
- package/dist/cjs/routes/types.d.ts.map +1 -0
- package/dist/cjs/routes/types.js +3 -0
- package/dist/cjs/routes/types.js.map +1 -0
- package/dist/cjs/tasks.d.ts +7 -0
- package/dist/cjs/tasks.d.ts.map +1 -0
- package/dist/cjs/tasks.js +65 -0
- package/dist/cjs/tasks.js.map +1 -0
- package/dist/cjs/types.d.ts +73 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +35 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/whscan-api.d.ts +172 -0
- package/dist/cjs/whscan-api.d.ts.map +1 -0
- package/dist/cjs/whscan-api.js +243 -0
- package/dist/cjs/whscan-api.js.map +1 -0
- package/dist/cjs/wormhole.d.ts +198 -0
- package/dist/cjs/wormhole.d.ts.map +1 -0
- package/dist/cjs/wormhole.js +324 -0
- package/dist/cjs/wormhole.js.map +1 -0
- package/dist/cjs/wormholeTransfer.d.ts +78 -0
- package/dist/cjs/wormholeTransfer.d.ts.map +1 -0
- package/dist/cjs/wormholeTransfer.js +27 -0
- package/dist/cjs/wormholeTransfer.js.map +1 -0
- package/dist/esm/circle-api.d.ts +16 -0
- package/dist/esm/circle-api.d.ts.map +1 -0
- package/dist/esm/circle-api.js +39 -0
- package/dist/esm/circle-api.js.map +1 -0
- package/dist/esm/common.d.ts +4 -0
- package/dist/esm/common.d.ts.map +1 -0
- package/dist/esm/common.js +36 -0
- package/dist/esm/common.js.map +1 -0
- package/dist/esm/config.d.ts +34 -0
- package/dist/esm/config.d.ts.map +1 -0
- package/dist/esm/config.js +47 -0
- package/dist/esm/config.js.map +1 -0
- package/dist/esm/index.d.ts +15 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/protocols/cctp/cctpTransfer.d.ts +41 -0
- package/dist/esm/protocols/cctp/cctpTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/cctp/cctpTransfer.js +455 -0
- package/dist/esm/protocols/cctp/cctpTransfer.js.map +1 -0
- package/dist/esm/protocols/cctp/index.d.ts +2 -0
- package/dist/esm/protocols/cctp/index.d.ts.map +1 -0
- package/dist/esm/protocols/cctp/index.js +2 -0
- package/dist/esm/protocols/cctp/index.js.map +1 -0
- package/dist/esm/protocols/cctpTransfer.d.ts +41 -0
- package/dist/esm/protocols/cctpTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/cctpTransfer.js +455 -0
- package/dist/esm/protocols/cctpTransfer.js.map +1 -0
- package/dist/esm/protocols/gateway/gatewayTransfer.d.ts +38 -0
- package/dist/esm/protocols/gateway/gatewayTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/gateway/gatewayTransfer.js +356 -0
- package/dist/esm/protocols/gateway/gatewayTransfer.js.map +1 -0
- package/dist/esm/protocols/gateway/index.d.ts +2 -0
- package/dist/esm/protocols/gateway/index.d.ts.map +1 -0
- package/dist/esm/protocols/gateway/index.js +2 -0
- package/dist/esm/protocols/gateway/index.js.map +1 -0
- package/dist/esm/protocols/gatewayTransfer.d.ts +40 -0
- package/dist/esm/protocols/gatewayTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/gatewayTransfer.js +402 -0
- package/dist/esm/protocols/gatewayTransfer.js.map +1 -0
- package/dist/esm/protocols/index.d.ts +5 -0
- package/dist/esm/protocols/index.d.ts.map +1 -0
- package/dist/esm/protocols/index.js +5 -0
- package/dist/esm/protocols/index.js.map +1 -0
- package/dist/esm/protocols/tokenBridge/automatic.d.ts +16 -0
- package/dist/esm/protocols/tokenBridge/automatic.d.ts.map +1 -0
- package/dist/esm/protocols/tokenBridge/automatic.js +73 -0
- package/dist/esm/protocols/tokenBridge/automatic.js.map +1 -0
- package/dist/esm/protocols/tokenBridge/index.d.ts +5 -0
- package/dist/esm/protocols/tokenBridge/index.d.ts.map +1 -0
- package/dist/esm/protocols/tokenBridge/index.js +5 -0
- package/dist/esm/protocols/tokenBridge/index.js.map +1 -0
- package/dist/esm/protocols/tokenBridge/manual.d.ts +16 -0
- package/dist/esm/protocols/tokenBridge/manual.d.ts.map +1 -0
- package/dist/esm/protocols/tokenBridge/manual.js +73 -0
- package/dist/esm/protocols/tokenBridge/manual.js.map +1 -0
- package/dist/esm/protocols/tokenBridge/tokenTransfer.d.ts +20 -0
- package/dist/esm/protocols/tokenBridge/tokenTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/tokenBridge/tokenTransfer.js +20 -0
- package/dist/esm/protocols/tokenBridge/tokenTransfer.js.map +1 -0
- package/dist/esm/protocols/tokenBridge/utils.d.ts +25 -0
- package/dist/esm/protocols/tokenBridge/utils.d.ts.map +1 -0
- package/dist/esm/protocols/tokenBridge/utils.js +323 -0
- package/dist/esm/protocols/tokenBridge/utils.js.map +1 -0
- package/dist/esm/protocols/tokenTransfer.d.ts +40 -0
- package/dist/esm/protocols/tokenTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/tokenTransfer.js +468 -0
- package/dist/esm/protocols/tokenTransfer.js.map +1 -0
- package/dist/esm/protocols/tokenbridge/automatic.d.ts +16 -0
- package/dist/esm/protocols/tokenbridge/automatic.d.ts.map +1 -0
- package/dist/esm/protocols/tokenbridge/automatic.js +72 -0
- package/dist/esm/protocols/tokenbridge/automatic.js.map +1 -0
- package/dist/esm/protocols/tokenbridge/index.d.ts +2 -0
- package/dist/esm/protocols/tokenbridge/index.d.ts.map +1 -0
- package/dist/esm/protocols/tokenbridge/index.js +2 -0
- package/dist/esm/protocols/tokenbridge/index.js.map +1 -0
- package/dist/esm/protocols/tokenbridge/manual.d.ts +16 -0
- package/dist/esm/protocols/tokenbridge/manual.d.ts.map +1 -0
- package/dist/esm/protocols/tokenbridge/manual.js +72 -0
- package/dist/esm/protocols/tokenbridge/manual.js.map +1 -0
- package/dist/esm/protocols/tokenbridge/tokenTransfer.d.ts +37 -0
- package/dist/esm/protocols/tokenbridge/tokenTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/tokenbridge/tokenTransfer.js +337 -0
- package/dist/esm/protocols/tokenbridge/tokenTransfer.js.map +1 -0
- package/dist/esm/protocols/wormholeTransfer.d.ts +20 -0
- package/dist/esm/protocols/wormholeTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/wormholeTransfer.js +2 -0
- package/dist/esm/protocols/wormholeTransfer.js.map +1 -0
- package/dist/esm/routes/automaticTokenBridgeRoute.d.ts +28 -0
- package/dist/esm/routes/automaticTokenBridgeRoute.d.ts.map +1 -0
- package/dist/esm/routes/automaticTokenBridgeRoute.js +78 -0
- package/dist/esm/routes/automaticTokenBridgeRoute.js.map +1 -0
- package/dist/esm/routes/cctp/automatic.d.ts +46 -0
- package/dist/esm/routes/cctp/automatic.d.ts.map +1 -0
- package/dist/esm/routes/cctp/automatic.js +131 -0
- package/dist/esm/routes/cctp/automatic.js.map +1 -0
- package/dist/esm/routes/cctp/index.d.ts +3 -0
- package/dist/esm/routes/cctp/index.d.ts.map +1 -0
- package/dist/esm/routes/cctp/index.js +3 -0
- package/dist/esm/routes/cctp/index.js.map +1 -0
- package/dist/esm/routes/cctp/manual.d.ts +43 -0
- package/dist/esm/routes/cctp/manual.d.ts.map +1 -0
- package/dist/esm/routes/cctp/manual.js +109 -0
- package/dist/esm/routes/cctp/manual.js.map +1 -0
- package/dist/esm/routes/common.d.ts +13 -0
- package/dist/esm/routes/common.d.ts.map +1 -0
- package/dist/esm/routes/common.js +41 -0
- package/dist/esm/routes/common.js.map +1 -0
- package/dist/esm/routes/index.d.ts +9 -0
- package/dist/esm/routes/index.d.ts.map +1 -0
- package/dist/esm/routes/index.js +9 -0
- package/dist/esm/routes/index.js.map +1 -0
- package/dist/esm/routes/mock/automatic.d.ts +25 -0
- package/dist/esm/routes/mock/automatic.d.ts.map +1 -0
- package/dist/esm/routes/mock/automatic.js +84 -0
- package/dist/esm/routes/mock/automatic.js.map +1 -0
- package/dist/esm/routes/mock/index.d.ts +3 -0
- package/dist/esm/routes/mock/index.d.ts.map +1 -0
- package/dist/esm/routes/mock/index.js +3 -0
- package/dist/esm/routes/mock/index.js.map +1 -0
- package/dist/esm/routes/mock/manual.d.ts +24 -0
- package/dist/esm/routes/mock/manual.d.ts.map +1 -0
- package/dist/esm/routes/mock/manual.js +83 -0
- package/dist/esm/routes/mock/manual.js.map +1 -0
- package/dist/esm/routes/portico/automatic.d.ts +68 -0
- package/dist/esm/routes/portico/automatic.d.ts.map +1 -0
- package/dist/esm/routes/portico/automatic.js +204 -0
- package/dist/esm/routes/portico/automatic.js.map +1 -0
- package/dist/esm/routes/portico/index.d.ts +2 -0
- package/dist/esm/routes/portico/index.d.ts.map +1 -0
- package/dist/esm/routes/portico/index.js +2 -0
- package/dist/esm/routes/portico/index.js.map +1 -0
- package/dist/esm/routes/portico/manual.d.ts +61 -0
- package/dist/esm/routes/portico/manual.d.ts.map +1 -0
- package/dist/esm/routes/portico/manual.js +137 -0
- package/dist/esm/routes/portico/manual.js.map +1 -0
- package/dist/esm/routes/portico/utils.d.ts +1 -0
- package/dist/esm/routes/portico/utils.d.ts.map +1 -0
- package/dist/esm/routes/portico/utils.js +2 -0
- package/dist/esm/routes/portico/utils.js.map +1 -0
- package/dist/esm/routes/request.d.ts +25 -0
- package/dist/esm/routes/request.d.ts.map +1 -0
- package/dist/esm/routes/request.js +61 -0
- package/dist/esm/routes/request.js.map +1 -0
- package/dist/esm/routes/resolver.d.ts +15 -0
- package/dist/esm/routes/resolver.d.ts.map +1 -0
- package/dist/esm/routes/resolver.js +83 -0
- package/dist/esm/routes/resolver.js.map +1 -0
- package/dist/esm/routes/route.d.ts +46 -0
- package/dist/esm/routes/route.d.ts.map +1 -0
- package/dist/esm/routes/route.js +26 -0
- package/dist/esm/routes/route.js.map +1 -0
- package/dist/esm/routes/token.d.ts +12 -0
- package/dist/esm/routes/token.d.ts.map +1 -0
- package/dist/esm/routes/token.js +31 -0
- package/dist/esm/routes/token.js.map +1 -0
- package/dist/esm/routes/tokenBridge/automatic.d.ts +46 -0
- package/dist/esm/routes/tokenBridge/automatic.d.ts.map +1 -0
- package/dist/esm/routes/tokenBridge/automatic.js +141 -0
- package/dist/esm/routes/tokenBridge/automatic.js.map +1 -0
- package/dist/esm/routes/tokenBridge/index.d.ts +3 -0
- package/dist/esm/routes/tokenBridge/index.d.ts.map +1 -0
- package/dist/esm/routes/tokenBridge/index.js +3 -0
- package/dist/esm/routes/tokenBridge/index.js.map +1 -0
- package/dist/esm/routes/tokenBridge/manual.d.ts +42 -0
- package/dist/esm/routes/tokenBridge/manual.d.ts.map +1 -0
- package/dist/esm/routes/tokenBridge/manual.js +83 -0
- package/dist/esm/routes/tokenBridge/manual.js.map +1 -0
- package/dist/esm/routes/tokenBridgeRoute.d.ts +25 -0
- package/dist/esm/routes/tokenBridgeRoute.d.ts.map +1 -0
- package/dist/esm/routes/tokenBridgeRoute.js +74 -0
- package/dist/esm/routes/tokenBridgeRoute.js.map +1 -0
- package/dist/esm/routes/types.d.ts +44 -0
- package/dist/esm/routes/types.d.ts.map +1 -0
- package/dist/esm/routes/types.js +2 -0
- package/dist/esm/routes/types.js.map +1 -0
- package/dist/esm/tasks.d.ts +7 -0
- package/dist/esm/tasks.d.ts.map +1 -0
- package/dist/esm/tasks.js +59 -0
- package/dist/esm/tasks.js.map +1 -0
- package/dist/esm/types.d.ts +73 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +27 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/whscan-api.d.ts +172 -0
- package/dist/esm/whscan-api.d.ts.map +1 -0
- package/dist/esm/whscan-api.js +222 -0
- package/dist/esm/whscan-api.js.map +1 -0
- package/dist/esm/wormhole.d.ts +198 -0
- package/dist/esm/wormhole.d.ts.map +1 -0
- package/dist/esm/wormhole.js +320 -0
- package/dist/esm/wormhole.js.map +1 -0
- package/dist/esm/wormholeTransfer.d.ts +78 -0
- package/dist/esm/wormholeTransfer.d.ts.map +1 -0
- package/dist/esm/wormholeTransfer.js +21 -0
- package/dist/esm/wormholeTransfer.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,OAAO,EACP,aAAa,EACd,MAAM,sCAAsC,CAAC;AAG9C,oBAAY,aAAa;IACvB,MAAM,KAAK;IACX,OAAO,IAAI;IACX,eAAe,IAAA;IACf,eAAe,IAAA;IACf,QAAQ,IAAA;IACR,oBAAoB,IAAA;IACpB,oBAAoB,IAAA;CACrB;AAKD,MAAM,MAAM,kBAAkB,CAAC,EAAE,SAAS,YAAY,GAAG,YAAY,IAAI;IACvE,EAAE,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;CAC/B,CAAC;AAGF,UAAU,mBAAmB,CAAC,EAAE,SAAS,KAAK,EAAE,EAAE,SAAS,KAAK;IAC9D,IAAI,EAAE,EAAE,CAAC;IACT,EAAE,EAAE,EAAE,CAAC;IACP,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB,CAAC,EAAE,SAAS,KAAK,GAAG,KAAK,EAAE,EAAE,SAAS,KAAK,GAAG,KAAK,CACxF,SAAQ,mBAAmB,CAAC,EAAE,EAAE,EAAE,CAAC;IACnC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,8BAA8B,CAAC,EAAE,SAAS,KAAK,GAAG,KAAK,EAAE,EAAE,SAAS,KAAK,GAAG,KAAK,CAChG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E,CAAC,GAC1C,uBAAuB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GACnC,wBAAwB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAIzC,MAAM,WAAW,aAAa;IAI5B,WAAW,EAAE;QACX,KAAK,EAAE,OAAO,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAGF,gBAAgB,EAAE;QAChB,KAAK,EAAE,OAAO,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAGF,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,OAAO,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAIF,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Transfer state machine states
|
|
2
|
+
export var TransferState;
|
|
3
|
+
(function (TransferState) {
|
|
4
|
+
TransferState[TransferState["Failed"] = -1] = "Failed";
|
|
5
|
+
TransferState[TransferState["Created"] = 0] = "Created";
|
|
6
|
+
TransferState[TransferState["SourceInitiated"] = 1] = "SourceInitiated";
|
|
7
|
+
TransferState[TransferState["SourceFinalized"] = 2] = "SourceFinalized";
|
|
8
|
+
TransferState[TransferState["Attested"] = 3] = "Attested";
|
|
9
|
+
TransferState[TransferState["DestinationInitiated"] = 4] = "DestinationInitiated";
|
|
10
|
+
TransferState[TransferState["DestinationFinalized"] = 5] = "DestinationFinalized";
|
|
11
|
+
})(TransferState || (TransferState = {}));
|
|
12
|
+
export function isSourceInitiated(receipt) {
|
|
13
|
+
return receipt.state === TransferState.SourceInitiated;
|
|
14
|
+
}
|
|
15
|
+
export function isSourceFinalized(receipt) {
|
|
16
|
+
return receipt.state === TransferState.SourceFinalized;
|
|
17
|
+
}
|
|
18
|
+
export function isAttested(receipt) {
|
|
19
|
+
return receipt.state === TransferState.Attested;
|
|
20
|
+
}
|
|
21
|
+
export function isCompleted(receipt) {
|
|
22
|
+
return receipt.state > TransferState.Attested;
|
|
23
|
+
}
|
|
24
|
+
export function isFailed(receipt) {
|
|
25
|
+
return receipt.state < 0;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AASA,gCAAgC;AAChC,MAAM,CAAN,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,sDAAW,CAAA;IACX,uDAAW,CAAA;IACX,uEAAe,CAAA;IACf,uEAAe,CAAA;IACf,yDAAQ,CAAA;IACR,iFAAoB,CAAA;IACpB,iFAAoB,CAAA;AACtB,CAAC,EARW,aAAa,KAAb,aAAa,QAQxB;AA8DD,MAAM,UAAU,iBAAiB,CAC/B,OAA4B;IAE5B,OAAO,OAAO,CAAC,KAAK,KAAK,aAAa,CAAC,eAAe,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,OAA4B;IAE5B,OAAO,OAAO,CAAC,KAAK,KAAK,aAAa,CAAC,eAAe,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,OAA4B;IAE5B,OAAO,OAAO,CAAC,KAAK,KAAK,aAAa,CAAC,QAAQ,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,OAA4B;IAE5B,OAAO,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAK,OAA4B;IACvD,OAAO,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Chain } from "@wormhole-foundation/sdk-base";
|
|
2
|
+
import { PayloadDiscriminator, PayloadLiteral, TxHash, WormholeMessageId, deserialize } from "@wormhole-foundation/sdk-definitions";
|
|
3
|
+
export declare const WHSCAN_RETRY_INTERVAL = 2000;
|
|
4
|
+
/**
|
|
5
|
+
* The status of a transaction
|
|
6
|
+
*
|
|
7
|
+
* contains information about the transaction and the global transaction if it was relayed
|
|
8
|
+
*/
|
|
9
|
+
export interface TransactionStatus {
|
|
10
|
+
id: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
txHash: string;
|
|
13
|
+
emitterChain: number;
|
|
14
|
+
emitterAddress: string;
|
|
15
|
+
emitterNativeAddress: string;
|
|
16
|
+
payload: {
|
|
17
|
+
amount: string;
|
|
18
|
+
callerAppId: string;
|
|
19
|
+
fee: string;
|
|
20
|
+
fromAddress: string;
|
|
21
|
+
parsedPayload: any;
|
|
22
|
+
payload: string;
|
|
23
|
+
payloadType: number;
|
|
24
|
+
toAddress: string;
|
|
25
|
+
toChain: number;
|
|
26
|
+
tokenAddress: string;
|
|
27
|
+
tokenChain: number;
|
|
28
|
+
};
|
|
29
|
+
standardizedProperties: {
|
|
30
|
+
amount: string;
|
|
31
|
+
appIds: string[];
|
|
32
|
+
fee: string;
|
|
33
|
+
feeAddress: string;
|
|
34
|
+
feeChain: number;
|
|
35
|
+
fromAddress: string;
|
|
36
|
+
fromChain: number;
|
|
37
|
+
toAddress: string;
|
|
38
|
+
toChain: number;
|
|
39
|
+
tokenAddress: string;
|
|
40
|
+
tokenChain: number;
|
|
41
|
+
};
|
|
42
|
+
globalTx?: {
|
|
43
|
+
id: string;
|
|
44
|
+
originTx: {
|
|
45
|
+
txHash: string;
|
|
46
|
+
from: string;
|
|
47
|
+
status: string;
|
|
48
|
+
};
|
|
49
|
+
destinationTx?: {
|
|
50
|
+
chainId: number;
|
|
51
|
+
status: string;
|
|
52
|
+
method: string;
|
|
53
|
+
txHash: string;
|
|
54
|
+
from: string;
|
|
55
|
+
to: string;
|
|
56
|
+
blockNumber: string;
|
|
57
|
+
timestamp: string;
|
|
58
|
+
updatedAt: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface RelayData {
|
|
63
|
+
from: {
|
|
64
|
+
chain: string;
|
|
65
|
+
chainId: number;
|
|
66
|
+
txHash: string;
|
|
67
|
+
senderAddress: string;
|
|
68
|
+
symbol: string;
|
|
69
|
+
amountSent: number;
|
|
70
|
+
amountToSwap: number;
|
|
71
|
+
estimatedNativeAssetAmount: number;
|
|
72
|
+
};
|
|
73
|
+
vaa: string;
|
|
74
|
+
status: string;
|
|
75
|
+
fee: {
|
|
76
|
+
amount: number;
|
|
77
|
+
symbol: string;
|
|
78
|
+
};
|
|
79
|
+
error: any;
|
|
80
|
+
to: {
|
|
81
|
+
chain: string;
|
|
82
|
+
chainId: number;
|
|
83
|
+
recipientAddress: string;
|
|
84
|
+
txHash: string;
|
|
85
|
+
gasUsed: number;
|
|
86
|
+
nativeAssetSymbol: string;
|
|
87
|
+
nativeAssetReceived: number;
|
|
88
|
+
};
|
|
89
|
+
metrics: {
|
|
90
|
+
receivedAt: string;
|
|
91
|
+
completedAt: string;
|
|
92
|
+
failedAt: any;
|
|
93
|
+
attempts: number;
|
|
94
|
+
maxAttempts: number;
|
|
95
|
+
waitingForTxInMs: number;
|
|
96
|
+
waitingForWalletInMs: number;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface ApiVaa {
|
|
100
|
+
sequence: number;
|
|
101
|
+
id: string;
|
|
102
|
+
version: number;
|
|
103
|
+
emitterChain: number;
|
|
104
|
+
emitterAddr: string;
|
|
105
|
+
emitterNativeAddr: string;
|
|
106
|
+
guardianSetIndex: number;
|
|
107
|
+
vaa: string;
|
|
108
|
+
timestamp: string;
|
|
109
|
+
updatedAt: string;
|
|
110
|
+
indexedAt: string;
|
|
111
|
+
txHash: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Gets the bytes of a VAA for a given WormholeMessageId or `null` if the VAA is not available yet.
|
|
115
|
+
* @param apiUrl the url of the wormholescan API
|
|
116
|
+
* @param whm the WormholeMessageId
|
|
117
|
+
* @returns a Uint8Array containing the VAA or `null` if it's not available yet
|
|
118
|
+
* @throws Errors if the service throws an unrecoverable error (e.g. 500)
|
|
119
|
+
*/
|
|
120
|
+
export declare function getVaaBytes(apiUrl: string, whm: WormholeMessageId): Promise<Uint8Array | null>;
|
|
121
|
+
export declare function getVaaBytesWithRetry(apiUrl: string, whm: WormholeMessageId, timeout: number): Promise<Uint8Array | null>;
|
|
122
|
+
export declare function getVaa<T extends PayloadLiteral | PayloadDiscriminator>(apiUrl: string, whm: WormholeMessageId, decodeAs: T): Promise<ReturnType<typeof deserialize<T>> | null>;
|
|
123
|
+
export declare function getVaaWithRetry<T extends PayloadLiteral | PayloadDiscriminator>(apiUrl: string, whm: WormholeMessageId, decodeAs: T, timeout: number): Promise<ReturnType<typeof deserialize<T>> | null>;
|
|
124
|
+
/**
|
|
125
|
+
* Gets the status for a transaction given WormholeMessageId or `null` if the VAA is not available yet.
|
|
126
|
+
* @param rpcUrl the url of the wormholescan API
|
|
127
|
+
* @param whm the WormholeMessageId
|
|
128
|
+
* @returns a TransactionStatus or `null` if it's not available yet
|
|
129
|
+
* @throws Errors if the service throws an unrecoverable error (e.g. 500)
|
|
130
|
+
*/
|
|
131
|
+
export declare function getTransactionStatus(rpcUrl: string, whm: WormholeMessageId): Promise<TransactionStatus | null>;
|
|
132
|
+
export declare function getTransactionStatusWithRetry(rpcUrl: string, whm: WormholeMessageId, timeout: number): Promise<TransactionStatus | null>;
|
|
133
|
+
export declare function getRelayStatus(rpcUrl: string, txid: TxHash): Promise<RelayData | null>;
|
|
134
|
+
export declare function getRelayStatusWithRetry(rpcUrl: string, txid: TxHash, timeout: number): Promise<RelayData | null>;
|
|
135
|
+
export declare function getVaaByTxHash(rpcUrl: string, txid: string): Promise<ApiVaa | null>;
|
|
136
|
+
export declare function getVaaByTxHashWithRetry<T extends PayloadLiteral | PayloadDiscriminator>(rpcUrl: string, txid: TxHash, decodeAs: T, timeout: number): Promise<ReturnType<typeof deserialize<T>> | null>;
|
|
137
|
+
export declare function getTxsByAddress(rpcUrl: string, address: string, pageSize?: number, page?: number): Promise<TransactionStatus[] | null>;
|
|
138
|
+
export type GuardianHeartbeat = {
|
|
139
|
+
p2pNodeAddr: string;
|
|
140
|
+
rawHeartbeat: {
|
|
141
|
+
bootTimestamp: string;
|
|
142
|
+
counter: string;
|
|
143
|
+
features: string[];
|
|
144
|
+
guardianAddr: string;
|
|
145
|
+
networks: {
|
|
146
|
+
contractAddress: string;
|
|
147
|
+
errorCount: string;
|
|
148
|
+
height: string;
|
|
149
|
+
id: number;
|
|
150
|
+
}[];
|
|
151
|
+
nodeName: string;
|
|
152
|
+
timestamp: string;
|
|
153
|
+
version: string;
|
|
154
|
+
};
|
|
155
|
+
verifiedGuardianAddr: string;
|
|
156
|
+
};
|
|
157
|
+
export declare function getGuardianHeartbeats(rpcUrl: string): Promise<GuardianHeartbeat[] | null>;
|
|
158
|
+
export type GovernedTokens = {
|
|
159
|
+
[chain in Chain]?: Record<string, number>;
|
|
160
|
+
};
|
|
161
|
+
export declare function getGovernedTokens(rpcUrl: string): Promise<GovernedTokens | null>;
|
|
162
|
+
export type GovernorChainLimit = {
|
|
163
|
+
available: number;
|
|
164
|
+
limit: number;
|
|
165
|
+
maxSize?: number;
|
|
166
|
+
};
|
|
167
|
+
export type GovernorLimits = {
|
|
168
|
+
[chain in Chain]?: GovernorChainLimit;
|
|
169
|
+
};
|
|
170
|
+
export declare function getGovernorLimits(rpcUrl: string): Promise<GovernorLimits | null>;
|
|
171
|
+
export declare function getIsVaaEnqueued(rpcUrl: string, whm: WormholeMessageId): Promise<boolean | null>;
|
|
172
|
+
//# sourceMappingURL=whscan-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whscan-api.d.ts","sourceRoot":"","sources":["../../src/whscan-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAwC,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,MAAM,EACN,iBAAiB,EACjB,WAAW,EACZ,MAAM,sCAA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;YACxB,UAAU,EAAE,MAAM,CAAC;YACnB,MAAM,EAAE,MAAM,CAAC;YACf,EAAE,EAAE,MAAM,CAAC;SACZ,EAAE,CAAC;QACJ,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC,CAO/F;AASD,MAAM,MAAM,cAAc,GAAG;KAE1B,KAAK,IAAI,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAC1C,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CActF;AASD,MAAM,MAAM,kBAAkB,GAAG;IAE/B,SAAS,EAAE,MAAM,CAAC;IAElB,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,cAAc,GAAG;KAC1B,KAAK,IAAI,KAAK,CAAC,CAAC,EAAE,kBAAkB;CACtC,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAsBtF;AAGD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAUzB"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { amount, encoding, toChain, toChainId } from "@wormhole-foundation/sdk-base";
|
|
2
|
+
import { deserialize, } from "@wormhole-foundation/sdk-definitions";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
import { retry } from "./tasks";
|
|
5
|
+
export const WHSCAN_RETRY_INTERVAL = 2000;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the bytes of a VAA for a given WormholeMessageId or `null` if the VAA is not available yet.
|
|
8
|
+
* @param apiUrl the url of the wormholescan API
|
|
9
|
+
* @param whm the WormholeMessageId
|
|
10
|
+
* @returns a Uint8Array containing the VAA or `null` if it's not available yet
|
|
11
|
+
* @throws Errors if the service throws an unrecoverable error (e.g. 500)
|
|
12
|
+
*/
|
|
13
|
+
export async function getVaaBytes(apiUrl, whm) {
|
|
14
|
+
const { chain, emitter, sequence } = whm;
|
|
15
|
+
const chainId = toChainId(chain);
|
|
16
|
+
const emitterAddress = encoding.stripPrefix("0x", emitter.toString());
|
|
17
|
+
const url = `${apiUrl}/v1/signed_vaa/${chainId}/${emitterAddress}/${sequence}`;
|
|
18
|
+
try {
|
|
19
|
+
const { data: { vaaBytes }, } = await axios.get(url);
|
|
20
|
+
return encoding.b64.decode(vaaBytes);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
if (!error)
|
|
24
|
+
return null;
|
|
25
|
+
if (typeof error === "object") {
|
|
26
|
+
// A 404 error means the VAA is not yet available
|
|
27
|
+
// since its not available yet, we return null signaling it can be tried again
|
|
28
|
+
if (axios.isAxiosError(error) && error.response?.status === 404)
|
|
29
|
+
return null;
|
|
30
|
+
if ("status" in error && error.status === 404)
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export async function getVaaBytesWithRetry(apiUrl, whm, timeout) {
|
|
37
|
+
const task = () => getVaaBytes(apiUrl, whm);
|
|
38
|
+
return await retry(task, WHSCAN_RETRY_INTERVAL, timeout, "Wormholescan:GetVaaBytes");
|
|
39
|
+
}
|
|
40
|
+
export async function getVaa(apiUrl, whm, decodeAs) {
|
|
41
|
+
const vaaBytes = await getVaaBytes(apiUrl, whm);
|
|
42
|
+
if (!vaaBytes)
|
|
43
|
+
return null;
|
|
44
|
+
return deserialize(decodeAs, vaaBytes);
|
|
45
|
+
}
|
|
46
|
+
export async function getVaaWithRetry(apiUrl, whm, decodeAs, timeout) {
|
|
47
|
+
const task = () => getVaa(apiUrl, whm, decodeAs);
|
|
48
|
+
return await retry(task, WHSCAN_RETRY_INTERVAL, timeout, "Wormholescan:GetVaaBytes");
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gets the status for a transaction given WormholeMessageId or `null` if the VAA is not available yet.
|
|
52
|
+
* @param rpcUrl the url of the wormholescan API
|
|
53
|
+
* @param whm the WormholeMessageId
|
|
54
|
+
* @returns a TransactionStatus or `null` if it's not available yet
|
|
55
|
+
* @throws Errors if the service throws an unrecoverable error (e.g. 500)
|
|
56
|
+
*/
|
|
57
|
+
export async function getTransactionStatus(rpcUrl, whm) {
|
|
58
|
+
const { chain, emitter, sequence } = whm;
|
|
59
|
+
const chainId = toChainId(chain);
|
|
60
|
+
const emitterAddress = emitter.toUniversalAddress().toString();
|
|
61
|
+
const url = `${rpcUrl}/api/v1/transactions/${chainId}/${emitterAddress}/${sequence}`;
|
|
62
|
+
try {
|
|
63
|
+
const response = await axios.get(url);
|
|
64
|
+
return response.data;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (!error)
|
|
68
|
+
return null;
|
|
69
|
+
if (typeof error === "object") {
|
|
70
|
+
// A 404 error means the VAA is not yet available
|
|
71
|
+
// since its not available yet, we return null signaling it can be tried again
|
|
72
|
+
if (axios.isAxiosError(error) && error.response?.status === 404)
|
|
73
|
+
return null;
|
|
74
|
+
if ("status" in error && error.status === 404)
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export async function getTransactionStatusWithRetry(rpcUrl, whm, timeout) {
|
|
81
|
+
const task = () => getTransactionStatus(rpcUrl, whm);
|
|
82
|
+
return await retry(task, WHSCAN_RETRY_INTERVAL, timeout, "Wormholescan:GetTransactionStatus");
|
|
83
|
+
}
|
|
84
|
+
export async function getRelayStatus(rpcUrl, txid) {
|
|
85
|
+
const url = `${rpcUrl}/v1/relays?txHash=${txid}`;
|
|
86
|
+
try {
|
|
87
|
+
const response = await axios.get(url);
|
|
88
|
+
if (response.data.data.to.txHash)
|
|
89
|
+
return response.data.data;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (!error)
|
|
93
|
+
return null;
|
|
94
|
+
if (typeof error === "object") {
|
|
95
|
+
// A 404 error means the VAA is not yet available
|
|
96
|
+
// since its not available yet, we return null signaling it can be tried again
|
|
97
|
+
if (axios.isAxiosError(error) && error.response?.status === 404)
|
|
98
|
+
return null;
|
|
99
|
+
if ("status" in error && error.status === 404)
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
export async function getRelayStatusWithRetry(rpcUrl, txid, timeout) {
|
|
107
|
+
const task = () => getRelayStatus(rpcUrl, txid);
|
|
108
|
+
return retry(task, WHSCAN_RETRY_INTERVAL, timeout, "Wormholescan:GetRelayStatus");
|
|
109
|
+
}
|
|
110
|
+
export async function getVaaByTxHash(rpcUrl, txid) {
|
|
111
|
+
const url = `${rpcUrl}/api/v1/vaas?txHash=${txid}`;
|
|
112
|
+
try {
|
|
113
|
+
const response = await axios.get(url);
|
|
114
|
+
if (response.data.data.length > 0)
|
|
115
|
+
return response.data.data[0];
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (!error)
|
|
119
|
+
return null;
|
|
120
|
+
if (typeof error === "object") {
|
|
121
|
+
// A 404 error means the VAA is not yet available
|
|
122
|
+
// since its not available yet, we return null signaling it can be tried again
|
|
123
|
+
if (axios.isAxiosError(error) && error.response?.status === 404)
|
|
124
|
+
return null;
|
|
125
|
+
if ("status" in error && error.status === 404)
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
export async function getVaaByTxHashWithRetry(rpcUrl, txid, decodeAs, timeout) {
|
|
133
|
+
const task = () => getVaaByTxHash(rpcUrl, txid);
|
|
134
|
+
const vaa = await retry(task, WHSCAN_RETRY_INTERVAL, timeout, "Wormholescan:GetVaaByTxHash");
|
|
135
|
+
if (!vaa)
|
|
136
|
+
return null;
|
|
137
|
+
return deserialize(decodeAs, encoding.b64.decode(vaa.vaa));
|
|
138
|
+
}
|
|
139
|
+
export async function getTxsByAddress(rpcUrl, address, pageSize = 50, page = 0) {
|
|
140
|
+
const url = `${rpcUrl}/api/v1/transactions?address=${address}&pageSize=${pageSize}&page=${page}`;
|
|
141
|
+
try {
|
|
142
|
+
const response = await axios.get(url);
|
|
143
|
+
if (response.data.transactions.length > 0)
|
|
144
|
+
return response.data.transactions;
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
if (!error)
|
|
148
|
+
return null;
|
|
149
|
+
if (typeof error === "object") {
|
|
150
|
+
// A 404 error means the VAA is not yet available
|
|
151
|
+
// since its not available yet, we return null signaling it can be tried again
|
|
152
|
+
if (axios.isAxiosError(error) && error.response?.status === 404)
|
|
153
|
+
return null;
|
|
154
|
+
if ("status" in error && error.status === 404)
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
export async function getGuardianHeartbeats(rpcUrl) {
|
|
162
|
+
const url = `${rpcUrl}/v1/heartbeats`;
|
|
163
|
+
try {
|
|
164
|
+
const response = await axios.get(url);
|
|
165
|
+
if (response.data && response.data.entries.length > 0)
|
|
166
|
+
return response.data.entries;
|
|
167
|
+
}
|
|
168
|
+
catch { }
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
export async function getGovernedTokens(rpcUrl) {
|
|
172
|
+
const url = `${rpcUrl}/v1/governor/token_list`;
|
|
173
|
+
try {
|
|
174
|
+
const response = await axios.get(url);
|
|
175
|
+
if (response.data && response.data.entries.length > 0) {
|
|
176
|
+
return response.data.entries.reduce((acc, entry) => {
|
|
177
|
+
const chain = toChain(entry.originChainId);
|
|
178
|
+
acc[chain] = acc[chain] || {};
|
|
179
|
+
acc[chain][entry.originAddress] = entry.price;
|
|
180
|
+
return acc;
|
|
181
|
+
}, {});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
catch { }
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
export async function getGovernorLimits(rpcUrl) {
|
|
188
|
+
const url = `${rpcUrl}/v1/governor/available_notional_by_chain`;
|
|
189
|
+
try {
|
|
190
|
+
const response = await axios.get(url);
|
|
191
|
+
if (response.data && response.data.entries.length > 0) {
|
|
192
|
+
return response.data.entries.reduce((acc, entry) => {
|
|
193
|
+
// if 0 consider it no limit
|
|
194
|
+
const maxSize = entry.bigTransactionSize === "0"
|
|
195
|
+
? undefined
|
|
196
|
+
: amount.whole(amount.parse(entry.bigTransactionSize, 2));
|
|
197
|
+
acc[toChain(entry.chainId)] = {
|
|
198
|
+
available: amount.whole(amount.parse(entry.remainingAvailableNotional, 2)),
|
|
199
|
+
limit: amount.whole(amount.parse(entry.notionalLimit, 2)),
|
|
200
|
+
maxSize,
|
|
201
|
+
};
|
|
202
|
+
return acc;
|
|
203
|
+
}, {});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
catch { }
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
// TODO: returning bool or null is asking for trouble
|
|
210
|
+
export async function getIsVaaEnqueued(rpcUrl, whm) {
|
|
211
|
+
const { chain, emitter, sequence } = whm;
|
|
212
|
+
const chainId = toChainId(chain);
|
|
213
|
+
const emitterAddress = emitter.toUniversalAddress().toString();
|
|
214
|
+
const url = `${rpcUrl}/v1/governor/is_vaa_enqueued/${chainId}/${emitterAddress}/${sequence}`;
|
|
215
|
+
try {
|
|
216
|
+
const response = await axios.get(url);
|
|
217
|
+
return response.data.isEnqueued;
|
|
218
|
+
}
|
|
219
|
+
catch { }
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=whscan-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whscan-api.js","sourceRoot":"","sources":["../../src/whscan-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAKL,WAAW,GACZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAkH1C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,GAAsB;IAEtB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC;IACzC,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IACjC,MAAM,cAAc,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtE,MAAM,GAAG,GAAG,GAAG,MAAM,kBAAkB,OAAO,IAAI,cAAc,IAAI,QAAQ,EAAE,CAAC;IAC/E,IAAI;QACF,MAAM,EACJ,IAAI,EAAE,EAAE,QAAQ,EAAE,GACnB,GAAG,MAAM,KAAK,CAAC,GAAG,CAAuB,GAAG,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;KACtC;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACxB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,iD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GAAG,CAAC;YACb,CAAC,EAAE,EAAoB,CAAC,CAAC;SAC1B;KACF;IAAC,MAAM,GAAE;IACV,OAAO,IAAI,CAAC;AACd,CAAC;AAED,qDAAqD;AACrD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,GAAsB;IAEtB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC;IACzC,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IACjC,MAAM,cAAc,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC/D,MAAM,GAAG,GAAG,GAAG,MAAM,gCAAgC,OAAO,IAAI,cAAc,IAAI,QAAQ,EAAE,CAAC;IAC7F,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAA0B,GAAG,CAAC,CAAC;QAC/D,OAAO,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC;KACjC;IAAC,MAAM,GAAE;IACV,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { Chain, Network, Platform } from "@wormhole-foundation/sdk-base";
|
|
2
|
+
import { ChainAddress, ChainContext, Contracts, NativeAddress, PayloadDiscriminator, PayloadLiteral, PlatformContext, PlatformUtils, TokenAddress, TokenId, TxHash, WormholeMessageId, deserialize } from "@wormhole-foundation/sdk-definitions";
|
|
3
|
+
import { ConfigOverrides, WormholeConfig } from "./config";
|
|
4
|
+
import { CircleTransfer } from "./protocols/cctpTransfer";
|
|
5
|
+
import { TokenTransfer } from "./protocols/tokenTransfer";
|
|
6
|
+
import { RouteConstructor } from "./routes";
|
|
7
|
+
import { RouteResolver } from "./routes/resolver";
|
|
8
|
+
import { TransactionStatus } from "./whscan-api";
|
|
9
|
+
type PlatformMap<N extends Network, P extends Platform = Platform> = Map<P, PlatformContext<N, P>>;
|
|
10
|
+
type ChainMap<N extends Network, C extends Chain = Chain> = Map<C, ChainContext<N, C>>;
|
|
11
|
+
export declare class Wormhole<N extends Network> {
|
|
12
|
+
protected readonly _network: N;
|
|
13
|
+
protected _platforms: PlatformMap<N>;
|
|
14
|
+
protected _chains: ChainMap<N>;
|
|
15
|
+
readonly config: WormholeConfig;
|
|
16
|
+
constructor(network: N, platforms: PlatformUtils<any>[], config?: ConfigOverrides);
|
|
17
|
+
get network(): N;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a CircleTransfer object to move Native USDC from one chain to another
|
|
20
|
+
* @param amount the amount to transfer
|
|
21
|
+
* @param from the address to transfer from
|
|
22
|
+
* @param to the address to transfer to
|
|
23
|
+
* @param automatic whether to use automatic delivery
|
|
24
|
+
* @param payload the payload to send with the transfer
|
|
25
|
+
* @param nativeGas the amount of native gas to send with the transfer
|
|
26
|
+
* @returns the CircleTransfer object
|
|
27
|
+
* @throws Errors if the chain or protocol is not supported
|
|
28
|
+
*/
|
|
29
|
+
circleTransfer(amount: bigint, from: ChainAddress, to: ChainAddress, automatic: boolean, payload?: Uint8Array, nativeGas?: bigint): Promise<CircleTransfer<N>>;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a TokenTransfer object to move a token from one chain to another
|
|
32
|
+
* @param token the token to transfer
|
|
33
|
+
* @param amount the amount to transfer
|
|
34
|
+
* @param from the address to transfer from
|
|
35
|
+
* @param to the address to transfer to
|
|
36
|
+
* @param automatic whether to use automatic delivery
|
|
37
|
+
* @param payload the payload to send with the transfer
|
|
38
|
+
* @param nativeGas the amount of native gas to send with the transfer
|
|
39
|
+
* @returns the TokenTransfer object
|
|
40
|
+
* @throws Errors if the chain or protocol is not supported
|
|
41
|
+
*/
|
|
42
|
+
tokenTransfer(token: TokenId, amount: bigint, from: ChainAddress, to: ChainAddress, automatic: boolean, payload?: Uint8Array, nativeGas?: bigint): Promise<TokenTransfer<N>>;
|
|
43
|
+
/**
|
|
44
|
+
* Gets a RouteResolver configured with the routes passed
|
|
45
|
+
* @param routes the list RouteConstructors to use
|
|
46
|
+
* @returns the RouteResolver
|
|
47
|
+
*/
|
|
48
|
+
resolver(routes: RouteConstructor[]): RouteResolver<N>;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the contract addresses for a given chain
|
|
51
|
+
* @param chain the chain name
|
|
52
|
+
* @returns the contract addresses
|
|
53
|
+
*/
|
|
54
|
+
getContracts(chain: Chain): Contracts | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the platform object, i.e. the class with platform-specific logic and methods
|
|
57
|
+
* @param chain the platform name
|
|
58
|
+
* @returns the platform context class
|
|
59
|
+
* @throws Errors if platform is not found
|
|
60
|
+
*/
|
|
61
|
+
getPlatform<P extends Platform>(platformName: P): PlatformContext<N, P>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the chain "context", i.e. the class with chain-specific logic and methods
|
|
64
|
+
* @param chain the chain name
|
|
65
|
+
* @returns the chain context class
|
|
66
|
+
* @throws Errors if context is not found
|
|
67
|
+
*/
|
|
68
|
+
getChain<C extends Chain>(chain: C): ChainContext<N, C>;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the TokenId for a token representation on any chain
|
|
71
|
+
* These are the Wormhole wrapped token addresses, not necessarily
|
|
72
|
+
* the cannonical version of that token
|
|
73
|
+
*
|
|
74
|
+
* @param chain The chain name to get the wrapped token address
|
|
75
|
+
* @param tokenId The Token ID (chain/address) of the original token
|
|
76
|
+
* @returns The TokenId on the given chain, null if it does not exist
|
|
77
|
+
* @throws Errors if the chain is not supported or the token does not exist
|
|
78
|
+
*/
|
|
79
|
+
getWrappedAsset<C extends Chain>(chain: C, token: TokenId<Chain>): Promise<TokenId<C>>;
|
|
80
|
+
/**
|
|
81
|
+
* Taking the original TokenId for some wrapped token chain
|
|
82
|
+
* These are the Wormhole wrapped token addresses, not necessarily
|
|
83
|
+
* the cannonical version of that token
|
|
84
|
+
*
|
|
85
|
+
* @param tokenId The Token ID of the token we're looking up the original asset for
|
|
86
|
+
* @returns The Original TokenId corresponding to the token id passed,
|
|
87
|
+
* @throws Errors if the chain is not supported or the token does not exist
|
|
88
|
+
*/
|
|
89
|
+
getOriginalAsset<C extends Chain>(token: TokenId<C>): Promise<TokenId<Chain>>;
|
|
90
|
+
/**
|
|
91
|
+
* Gets the number of decimals for a token on a given chain
|
|
92
|
+
*
|
|
93
|
+
* @param chain The chain name or id of the token/representation
|
|
94
|
+
* @param token The token address
|
|
95
|
+
* @returns The number of decimals
|
|
96
|
+
*/
|
|
97
|
+
getDecimals<C extends Chain>(chain: C, token: TokenAddress<C>): Promise<number>;
|
|
98
|
+
/**
|
|
99
|
+
* Fetches the balance of a given token for a wallet
|
|
100
|
+
*
|
|
101
|
+
* @param walletAddress The wallet address
|
|
102
|
+
* @param tokenId The token ID (its home chain and address on the home chain)
|
|
103
|
+
* @param chain The chain name or id
|
|
104
|
+
* @returns The token balance of the wormhole asset as a BigNumber
|
|
105
|
+
*/
|
|
106
|
+
getBalance<C extends Chain>(chain: C, token: TokenAddress<C>, walletAddress: string): Promise<bigint | null>;
|
|
107
|
+
/**
|
|
108
|
+
* Gets the associated token account for chains that require it (only Solana currently).
|
|
109
|
+
*
|
|
110
|
+
* @param token the TokenId of the token to get the token account for
|
|
111
|
+
* @param recipient the address of the primary account that may require a separate token account
|
|
112
|
+
* @returns
|
|
113
|
+
*/
|
|
114
|
+
getTokenAccount<C extends Chain>(recipient: ChainAddress<C>, token: TokenId<C>): Promise<ChainAddress<C>>;
|
|
115
|
+
/**
|
|
116
|
+
* Gets the Raw VAA Bytes from the API or Guardian RPC, finality must be met before the VAA will be available.
|
|
117
|
+
*
|
|
118
|
+
* @param wormholeMessageId The WormholeMessageId corresponding to the VAA to be fetched
|
|
119
|
+
* @param timeout The total amount of time to wait for the VAA to be available
|
|
120
|
+
* @returns The VAA bytes if available
|
|
121
|
+
* @throws Errors if the VAA is not available after the retries
|
|
122
|
+
*/
|
|
123
|
+
getVaaBytes(wormholeMessageId: WormholeMessageId, timeout?: number): Promise<Uint8Array | null>;
|
|
124
|
+
/**
|
|
125
|
+
* Gets a VAA from the API or Guardian RPC, finality must be met before the VAA will be available.
|
|
126
|
+
*
|
|
127
|
+
* @param id The WormholeMessageId or Transaction hash corresponding to the VAA to be fetched
|
|
128
|
+
* @param decodeAs The VAA type to decode the bytes as
|
|
129
|
+
* @param timeout The total amount of time to wait for the VAA to be available
|
|
130
|
+
* @returns The VAA if available
|
|
131
|
+
* @throws Errors if the VAA is not available after the retries
|
|
132
|
+
*/
|
|
133
|
+
getVaa<T extends PayloadLiteral | PayloadDiscriminator>(id: WormholeMessageId | TxHash, decodeAs: T, timeout?: number): Promise<ReturnType<typeof deserialize<T>> | null>;
|
|
134
|
+
/**
|
|
135
|
+
* Gets the CircleAttestation corresponding to the message hash logged in the transfer transaction.
|
|
136
|
+
* @param msgHash The keccak256 hash of the message emitted by the circle contract
|
|
137
|
+
* @param timeout The total amount of time to wait for the VAA to be available
|
|
138
|
+
* @returns The CircleAttestation as a string, if available
|
|
139
|
+
* @throws Errors if the CircleAttestation is not available after the retries
|
|
140
|
+
*/
|
|
141
|
+
getCircleAttestation(msgHash: string, timeout?: number): Promise<string | null>;
|
|
142
|
+
/**
|
|
143
|
+
* Get the status of a transaction, identified by the chain, emitter address, and sequence number
|
|
144
|
+
*
|
|
145
|
+
* @param id the message id for the Wormhole Message to get transaction status for or originating Transaction hash
|
|
146
|
+
* @returns the TransactionStatus
|
|
147
|
+
*/
|
|
148
|
+
getTransactionStatus(id: WormholeMessageId | TxHash, timeout?: number): Promise<TransactionStatus | null>;
|
|
149
|
+
/**
|
|
150
|
+
* Get recent transactions for an address
|
|
151
|
+
*
|
|
152
|
+
* @param address the string formatted address to get transactions for
|
|
153
|
+
* @returns the TransactionStatus
|
|
154
|
+
*/
|
|
155
|
+
getTransactionsForAddress(address: string, pageSize?: number, page?: number): Promise<TransactionStatus[] | null>;
|
|
156
|
+
/**
|
|
157
|
+
* Parse an address from its canonincal string format to a NativeAddress
|
|
158
|
+
*
|
|
159
|
+
* @param chain The chain the address is for
|
|
160
|
+
* @param address The address in canonical string format
|
|
161
|
+
* @returns The address in the NativeAddress format
|
|
162
|
+
*/
|
|
163
|
+
static parseAddress<C extends Chain>(chain: C, address: string): NativeAddress<C>;
|
|
164
|
+
/**
|
|
165
|
+
* Return a string in the canonical chain format representing the address
|
|
166
|
+
* of a token or account
|
|
167
|
+
*
|
|
168
|
+
* @param chainAddress The ChainAddress or TokenId to get a string address
|
|
169
|
+
* @returns The string address in canonical format for the chain
|
|
170
|
+
*/
|
|
171
|
+
static canonicalAddress(chainAddress: ChainAddress | TokenId): string;
|
|
172
|
+
/**
|
|
173
|
+
* Parse an address from its canonincal string format to a NativeAddress
|
|
174
|
+
*
|
|
175
|
+
* @param chain The chain the address is for
|
|
176
|
+
* @param address The native address in canonical string format
|
|
177
|
+
* @returns The ChainAddress
|
|
178
|
+
*/
|
|
179
|
+
static chainAddress<C extends Chain>(chain: C, address: string): ChainAddress<C>;
|
|
180
|
+
/**
|
|
181
|
+
* Parse an address from its canonincal string format to a NativeAddress
|
|
182
|
+
*
|
|
183
|
+
* @param chain The chain the address is for
|
|
184
|
+
* @param address The native address in canonical string format or the string "native"
|
|
185
|
+
* @returns The ChainAddress
|
|
186
|
+
*/
|
|
187
|
+
static tokenId<C extends Chain>(chain: C, address: string): TokenId<C>;
|
|
188
|
+
/**
|
|
189
|
+
* Parses all relevant information from a transaction given the sending tx hash and sending chain
|
|
190
|
+
*
|
|
191
|
+
* @param chain The sending chain name or context
|
|
192
|
+
* @param tx The sending transaction hash
|
|
193
|
+
* @returns The parsed WormholeMessageId
|
|
194
|
+
*/
|
|
195
|
+
static parseMessageFromTx<N extends Network, C extends Chain>(chain: ChainContext<N, C>, txid: TxHash, timeout?: number): Promise<WormholeMessageId[]>;
|
|
196
|
+
}
|
|
197
|
+
export {};
|
|
198
|
+
//# sourceMappingURL=wormhole.d.ts.map
|