@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,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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wormhole.d.ts","sourceRoot":"","sources":["../../src/wormhole.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAA2B,MAAM,+BAA+B,CAAC;AAClG,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,OAAO,EACP,MAAM,EACN,iBAAiB,EAEjB,WAAW,EAIZ,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAwB,cAAc,EAAkB,MAAM,UAAU,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO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,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC;IAIhF;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAItE;;;;;;OAMG;WACU,kBAAkB,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,KAAK,EAChE,KAAK,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAA6B,GACrC,OAAO,CAAC,iBAAiB,EAAE,CAAC;CAwBhC"}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Wormhole = void 0;
|
|
4
|
+
const sdk_base_1 = require("@wormhole-foundation/sdk-base");
|
|
5
|
+
const sdk_definitions_1 = require("@wormhole-foundation/sdk-definitions");
|
|
6
|
+
const circle_api_1 = require("./circle-api");
|
|
7
|
+
const config_1 = require("./config");
|
|
8
|
+
const cctpTransfer_1 = require("./protocols/cctpTransfer");
|
|
9
|
+
const tokenTransfer_1 = require("./protocols/tokenTransfer");
|
|
10
|
+
const resolver_1 = require("./routes/resolver");
|
|
11
|
+
const tasks_1 = require("./tasks");
|
|
12
|
+
const whscan_api_1 = require("./whscan-api");
|
|
13
|
+
class Wormhole {
|
|
14
|
+
_network;
|
|
15
|
+
_platforms;
|
|
16
|
+
_chains;
|
|
17
|
+
config;
|
|
18
|
+
constructor(network, platforms, config) {
|
|
19
|
+
this._network = network;
|
|
20
|
+
this.config = (0, config_1.applyOverrides)(network, config);
|
|
21
|
+
this._chains = new Map();
|
|
22
|
+
this._platforms = new Map();
|
|
23
|
+
for (const p of platforms) {
|
|
24
|
+
this._platforms.set(p._platform, new p(network));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
get network() {
|
|
28
|
+
return this._network;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Creates a CircleTransfer object to move Native USDC from one chain to another
|
|
32
|
+
* @param amount the amount to transfer
|
|
33
|
+
* @param from the address to transfer from
|
|
34
|
+
* @param to the address to transfer to
|
|
35
|
+
* @param automatic whether to use automatic delivery
|
|
36
|
+
* @param payload the payload to send with the transfer
|
|
37
|
+
* @param nativeGas the amount of native gas to send with the transfer
|
|
38
|
+
* @returns the CircleTransfer object
|
|
39
|
+
* @throws Errors if the chain or protocol is not supported
|
|
40
|
+
*/
|
|
41
|
+
async circleTransfer(amount, from, to, automatic, payload, nativeGas) {
|
|
42
|
+
if (automatic && payload)
|
|
43
|
+
throw new Error("Payload with automatic delivery is not supported");
|
|
44
|
+
if (!sdk_base_1.circle.isCircleChain(this.network, from.chain) ||
|
|
45
|
+
!sdk_base_1.circle.isCircleChain(this.network, to.chain) ||
|
|
46
|
+
!sdk_base_1.circle.isCircleSupported(this.network, from.chain) ||
|
|
47
|
+
!sdk_base_1.circle.isCircleSupported(this.network, to.chain))
|
|
48
|
+
throw new Error(`Network and chain not supported: ${this.network} ${from.chain} `);
|
|
49
|
+
// ensure the amount is > fee + native gas
|
|
50
|
+
if (automatic) {
|
|
51
|
+
const acb = await this.getChain(from.chain).getAutomaticCircleBridge();
|
|
52
|
+
const relayerFee = await acb.getRelayerFee(to.chain);
|
|
53
|
+
const minAmount = relayerFee + (nativeGas ? nativeGas : 0n);
|
|
54
|
+
if (amount < minAmount)
|
|
55
|
+
throw new Error(`Amount must be > ${minAmount} (relayerFee + nativeGas)`);
|
|
56
|
+
}
|
|
57
|
+
return await cctpTransfer_1.CircleTransfer.from(this, {
|
|
58
|
+
amount,
|
|
59
|
+
from,
|
|
60
|
+
to,
|
|
61
|
+
automatic,
|
|
62
|
+
payload,
|
|
63
|
+
nativeGas,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Creates a TokenTransfer object to move a token from one chain to another
|
|
68
|
+
* @param token the token to transfer
|
|
69
|
+
* @param amount the amount to transfer
|
|
70
|
+
* @param from the address to transfer from
|
|
71
|
+
* @param to the address to transfer to
|
|
72
|
+
* @param automatic whether to use automatic delivery
|
|
73
|
+
* @param payload the payload to send with the transfer
|
|
74
|
+
* @param nativeGas the amount of native gas to send with the transfer
|
|
75
|
+
* @returns the TokenTransfer object
|
|
76
|
+
* @throws Errors if the chain or protocol is not supported
|
|
77
|
+
*/
|
|
78
|
+
async tokenTransfer(token, amount, from, to, automatic, payload, nativeGas) {
|
|
79
|
+
return await tokenTransfer_1.TokenTransfer.from(this, {
|
|
80
|
+
token,
|
|
81
|
+
amount,
|
|
82
|
+
from,
|
|
83
|
+
to,
|
|
84
|
+
automatic,
|
|
85
|
+
payload,
|
|
86
|
+
nativeGas,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Gets a RouteResolver configured with the routes passed
|
|
91
|
+
* @param routes the list RouteConstructors to use
|
|
92
|
+
* @returns the RouteResolver
|
|
93
|
+
*/
|
|
94
|
+
resolver(routes) {
|
|
95
|
+
return new resolver_1.RouteResolver(this, routes);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Gets the contract addresses for a given chain
|
|
99
|
+
* @param chain the chain name
|
|
100
|
+
* @returns the contract addresses
|
|
101
|
+
*/
|
|
102
|
+
getContracts(chain) {
|
|
103
|
+
return this.config.chains[chain]?.contracts;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Returns the platform object, i.e. the class with platform-specific logic and methods
|
|
107
|
+
* @param chain the platform name
|
|
108
|
+
* @returns the platform context class
|
|
109
|
+
* @throws Errors if platform is not found
|
|
110
|
+
*/
|
|
111
|
+
getPlatform(platformName) {
|
|
112
|
+
const platform = this._platforms.get(platformName);
|
|
113
|
+
if (!platform)
|
|
114
|
+
throw new Error(`Not able to retrieve platform ${platform}`);
|
|
115
|
+
return platform;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Returns the chain "context", i.e. the class with chain-specific logic and methods
|
|
119
|
+
* @param chain the chain name
|
|
120
|
+
* @returns the chain context class
|
|
121
|
+
* @throws Errors if context is not found
|
|
122
|
+
*/
|
|
123
|
+
getChain(chain) {
|
|
124
|
+
const platform = (0, sdk_base_1.chainToPlatform)(chain);
|
|
125
|
+
if (!this._chains.has(chain))
|
|
126
|
+
this._chains.set(chain, this.getPlatform(platform).getChain(chain));
|
|
127
|
+
return this._chains.get(chain);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Gets the TokenId for a token representation on any chain
|
|
131
|
+
* These are the Wormhole wrapped token addresses, not necessarily
|
|
132
|
+
* the cannonical version of that token
|
|
133
|
+
*
|
|
134
|
+
* @param chain The chain name to get the wrapped token address
|
|
135
|
+
* @param tokenId The Token ID (chain/address) of the original token
|
|
136
|
+
* @returns The TokenId on the given chain, null if it does not exist
|
|
137
|
+
* @throws Errors if the chain is not supported or the token does not exist
|
|
138
|
+
*/
|
|
139
|
+
async getWrappedAsset(chain, token) {
|
|
140
|
+
const ctx = this.getChain(chain);
|
|
141
|
+
const tb = await ctx.getTokenBridge();
|
|
142
|
+
return { chain, address: await tb.getWrappedAsset(token) };
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Taking the original TokenId for some wrapped token chain
|
|
146
|
+
* These are the Wormhole wrapped token addresses, not necessarily
|
|
147
|
+
* the cannonical version of that token
|
|
148
|
+
*
|
|
149
|
+
* @param tokenId The Token ID of the token we're looking up the original asset for
|
|
150
|
+
* @returns The Original TokenId corresponding to the token id passed,
|
|
151
|
+
* @throws Errors if the chain is not supported or the token does not exist
|
|
152
|
+
*/
|
|
153
|
+
async getOriginalAsset(token) {
|
|
154
|
+
const ctx = this.getChain(token.chain);
|
|
155
|
+
const tb = await ctx.getTokenBridge();
|
|
156
|
+
return await tb.getOriginalAsset(token.address);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Gets the number of decimals for a token on a given chain
|
|
160
|
+
*
|
|
161
|
+
* @param chain The chain name or id of the token/representation
|
|
162
|
+
* @param token The token address
|
|
163
|
+
* @returns The number of decimals
|
|
164
|
+
*/
|
|
165
|
+
async getDecimals(chain, token) {
|
|
166
|
+
const ctx = this.getChain(chain);
|
|
167
|
+
return await ctx.getDecimals(token);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Fetches the balance of a given token for a wallet
|
|
171
|
+
*
|
|
172
|
+
* @param walletAddress The wallet address
|
|
173
|
+
* @param tokenId The token ID (its home chain and address on the home chain)
|
|
174
|
+
* @param chain The chain name or id
|
|
175
|
+
* @returns The token balance of the wormhole asset as a BigNumber
|
|
176
|
+
*/
|
|
177
|
+
async getBalance(chain, token, walletAddress) {
|
|
178
|
+
const ctx = this.getChain(chain);
|
|
179
|
+
return ctx.getBalance(walletAddress, token);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Gets the associated token account for chains that require it (only Solana currently).
|
|
183
|
+
*
|
|
184
|
+
* @param token the TokenId of the token to get the token account for
|
|
185
|
+
* @param recipient the address of the primary account that may require a separate token account
|
|
186
|
+
* @returns
|
|
187
|
+
*/
|
|
188
|
+
async getTokenAccount(recipient, token) {
|
|
189
|
+
return this.getChain(recipient.chain).getTokenAccount(recipient.address, token.address);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Gets the Raw VAA Bytes from the API or Guardian RPC, finality must be met before the VAA will be available.
|
|
193
|
+
*
|
|
194
|
+
* @param wormholeMessageId The WormholeMessageId corresponding to the VAA to be fetched
|
|
195
|
+
* @param timeout The total amount of time to wait for the VAA to be available
|
|
196
|
+
* @returns The VAA bytes if available
|
|
197
|
+
* @throws Errors if the VAA is not available after the retries
|
|
198
|
+
*/
|
|
199
|
+
async getVaaBytes(wormholeMessageId, timeout = config_1.DEFAULT_TASK_TIMEOUT) {
|
|
200
|
+
return await (0, whscan_api_1.getVaaBytesWithRetry)(this.config.api, wormholeMessageId, timeout);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Gets a VAA from the API or Guardian RPC, finality must be met before the VAA will be available.
|
|
204
|
+
*
|
|
205
|
+
* @param id The WormholeMessageId or Transaction hash corresponding to the VAA to be fetched
|
|
206
|
+
* @param decodeAs The VAA type to decode the bytes as
|
|
207
|
+
* @param timeout The total amount of time to wait for the VAA to be available
|
|
208
|
+
* @returns The VAA if available
|
|
209
|
+
* @throws Errors if the VAA is not available after the retries
|
|
210
|
+
*/
|
|
211
|
+
async getVaa(id, decodeAs, timeout = config_1.DEFAULT_TASK_TIMEOUT) {
|
|
212
|
+
if (typeof id === "string")
|
|
213
|
+
return await (0, whscan_api_1.getVaaByTxHashWithRetry)(this.config.api, id, decodeAs, timeout);
|
|
214
|
+
return await (0, whscan_api_1.getVaaWithRetry)(this.config.api, id, decodeAs, timeout);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Gets the CircleAttestation corresponding to the message hash logged in the transfer transaction.
|
|
218
|
+
* @param msgHash The keccak256 hash of the message emitted by the circle contract
|
|
219
|
+
* @param timeout The total amount of time to wait for the VAA to be available
|
|
220
|
+
* @returns The CircleAttestation as a string, if available
|
|
221
|
+
* @throws Errors if the CircleAttestation is not available after the retries
|
|
222
|
+
*/
|
|
223
|
+
async getCircleAttestation(msgHash, timeout = config_1.DEFAULT_TASK_TIMEOUT) {
|
|
224
|
+
return (0, circle_api_1.getCircleAttestationWithRetry)(this.config.circleAPI, msgHash, timeout);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Get the status of a transaction, identified by the chain, emitter address, and sequence number
|
|
228
|
+
*
|
|
229
|
+
* @param id the message id for the Wormhole Message to get transaction status for or originating Transaction hash
|
|
230
|
+
* @returns the TransactionStatus
|
|
231
|
+
*/
|
|
232
|
+
async getTransactionStatus(id, timeout = config_1.DEFAULT_TASK_TIMEOUT) {
|
|
233
|
+
let msgid;
|
|
234
|
+
// No txid endpoint exists to get the status by txhash yet
|
|
235
|
+
if (typeof id === "string") {
|
|
236
|
+
const vaa = await (0, whscan_api_1.getVaaByTxHashWithRetry)(this.config.api, id, "Uint8Array", timeout);
|
|
237
|
+
if (!vaa)
|
|
238
|
+
return null;
|
|
239
|
+
msgid = { emitter: vaa.emitterAddress, chain: vaa.emitterChain, sequence: vaa.sequence };
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
msgid = id;
|
|
243
|
+
}
|
|
244
|
+
return await (0, whscan_api_1.getTransactionStatusWithRetry)(this.config.api, msgid, timeout);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Get recent transactions for an address
|
|
248
|
+
*
|
|
249
|
+
* @param address the string formatted address to get transactions for
|
|
250
|
+
* @returns the TransactionStatus
|
|
251
|
+
*/
|
|
252
|
+
async getTransactionsForAddress(address, pageSize = 50, page = 0) {
|
|
253
|
+
return (0, whscan_api_1.getTxsByAddress)(this.config.api, address, pageSize, page);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Parse an address from its canonincal string format to a NativeAddress
|
|
257
|
+
*
|
|
258
|
+
* @param chain The chain the address is for
|
|
259
|
+
* @param address The address in canonical string format
|
|
260
|
+
* @returns The address in the NativeAddress format
|
|
261
|
+
*/
|
|
262
|
+
static parseAddress(chain, address) {
|
|
263
|
+
return (0, sdk_definitions_1.toNative)(chain, address);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Return a string in the canonical chain format representing the address
|
|
267
|
+
* of a token or account
|
|
268
|
+
*
|
|
269
|
+
* @param chainAddress The ChainAddress or TokenId to get a string address
|
|
270
|
+
* @returns The string address in canonical format for the chain
|
|
271
|
+
*/
|
|
272
|
+
static canonicalAddress(chainAddress) {
|
|
273
|
+
return (0, sdk_definitions_1.canonicalAddress)(chainAddress);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Parse an address from its canonincal string format to a NativeAddress
|
|
277
|
+
*
|
|
278
|
+
* @param chain The chain the address is for
|
|
279
|
+
* @param address The native address in canonical string format
|
|
280
|
+
* @returns The ChainAddress
|
|
281
|
+
*/
|
|
282
|
+
static chainAddress(chain, address) {
|
|
283
|
+
return { chain, address: Wormhole.parseAddress(chain, address) };
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Parse an address from its canonincal string format to a NativeAddress
|
|
287
|
+
*
|
|
288
|
+
* @param chain The chain the address is for
|
|
289
|
+
* @param address The native address in canonical string format or the string "native"
|
|
290
|
+
* @returns The ChainAddress
|
|
291
|
+
*/
|
|
292
|
+
static tokenId(chain, address) {
|
|
293
|
+
return (0, sdk_definitions_1.isNative)(address) ? (0, sdk_definitions_1.nativeTokenId)(chain) : this.chainAddress(chain, address);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Parses all relevant information from a transaction given the sending tx hash and sending chain
|
|
297
|
+
*
|
|
298
|
+
* @param chain The sending chain name or context
|
|
299
|
+
* @param tx The sending transaction hash
|
|
300
|
+
* @returns The parsed WormholeMessageId
|
|
301
|
+
*/
|
|
302
|
+
static async parseMessageFromTx(chain, txid, timeout = config_1.DEFAULT_TASK_TIMEOUT) {
|
|
303
|
+
const task = async () => {
|
|
304
|
+
try {
|
|
305
|
+
const msgs = await chain.parseTransaction(txid);
|
|
306
|
+
// possible the node we hit does not have this data yet
|
|
307
|
+
// return null to signal retry
|
|
308
|
+
if (msgs.length === 0)
|
|
309
|
+
return null;
|
|
310
|
+
return msgs;
|
|
311
|
+
}
|
|
312
|
+
catch (e) {
|
|
313
|
+
console.error(e);
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
const parsed = await (0, tasks_1.retry)(task, chain.config.blockTime, timeout, "WormholeCore:ParseMessageFromTransaction");
|
|
318
|
+
if (!parsed)
|
|
319
|
+
throw new Error(`No WormholeMessageId found for ${txid}`);
|
|
320
|
+
return parsed;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
exports.Wormhole = Wormhole;
|
|
324
|
+
//# sourceMappingURL=wormhole.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wormhole.js","sourceRoot":"","sources":["../../src/wormhole.ts"],"names":[],"mappings":";;;AAAA,4DAAkG;AAClG,0EAkB8C;AAC9C,6CAA6D;AAC7D,qCAAiG;AACjG,2DAA0D;AAC1D,6DAA0D;AAE1D,gDAAkD;AAClD,mCAAgC;AAChC,6CAOsB;AAKtB,MAAa,QAAQ;IACA,QAAQ,CAAI;IACrB,UAAU,CAAiB;IAC3B,OAAO,CAAc;IAEtB,MAAM,CAAiB;IAEhC,YAAY,OAAU,EAAE,SAA+B,EAAE,MAAwB;QAC/E,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,IAAA,uBAAc,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAE9C,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;QAC5B,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE;YACzB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;SAClD;IACH,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,cAAc,CAClB,MAAc,EACd,IAAkB,EAClB,EAAgB,EAChB,SAAkB,EAClB,OAAoB,EACpB,SAAkB;QAElB,IAAI,SAAS,IAAI,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QAE9F,IACE,CAAC,iBAAM,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC;YAC/C,CAAC,iBAAM,CAAC,aA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,IAAA,aAAK,EACxB,IAAI,EACJ,KAAK,CAAC,MAAM,CAAC,SAAS,EACtB,OAAO,EACP,0CAA0C,CAC3C,CAAC;QAEF,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,EAAE,CAAC,CAAC;QACvE,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAhYD,4BAgYC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Chain, Network, Platform, PlatformToChains, ProtocolName } from "@wormhole-foundation/sdk-base";
|
|
2
|
+
import { AttestationId, AttestationReceipt, ChainContext, CircleTransferDetails, GatewayTransferDetails, Signer, TokenId, TokenTransferDetails, TransactionId, TxHash } from "@wormhole-foundation/sdk-definitions";
|
|
3
|
+
import { Wormhole } from "./wormhole";
|
|
4
|
+
export type TransferRequest<PN extends ProtocolName = ProtocolName> = PN extends "TokenBridge" | "AutomaticTokenBridge" ? TokenTransferDetails : PN extends "CircleBridge" | "AutomaticCircleBridge" ? CircleTransferDetails : PN extends "IbcBridge" ? GatewayTransferDetails : never;
|
|
5
|
+
export declare enum TransferState {
|
|
6
|
+
Failed = -1,
|
|
7
|
+
Created = 0,
|
|
8
|
+
SourceInitiated = 1,
|
|
9
|
+
SourceFinalized = 2,
|
|
10
|
+
Attested = 3,
|
|
11
|
+
DestinationInitiated = 4,
|
|
12
|
+
DestinationFinalized = 5
|
|
13
|
+
}
|
|
14
|
+
interface BaseTransferReceipt<PN extends ProtocolName, SC extends Chain, DC extends Chain> {
|
|
15
|
+
protocol: PN;
|
|
16
|
+
from: SC;
|
|
17
|
+
to: DC;
|
|
18
|
+
request: TransferRequest<PN>;
|
|
19
|
+
state: TransferState;
|
|
20
|
+
}
|
|
21
|
+
export interface CreatedTransferReceipt<PN extends ProtocolName, SC extends Chain = Chain, DC extends Chain = Chain> extends BaseTransferReceipt<PN, SC, DC> {
|
|
22
|
+
state: TransferState.Created;
|
|
23
|
+
}
|
|
24
|
+
export interface SourceInitiatedTransferReceipt<PN extends ProtocolName, SC extends Chain = Chain, DC extends Chain = Chain> extends BaseTransferReceipt<PN, SC, DC> {
|
|
25
|
+
state: TransferState.SourceInitiated;
|
|
26
|
+
originTxs: TransactionId<SC>[];
|
|
27
|
+
}
|
|
28
|
+
export interface SourceFinalizedTransferReceipt<PN extends ProtocolName, SC extends Chain = Chain, DC extends Chain = Chain> extends BaseTransferReceipt<PN, SC, DC> {
|
|
29
|
+
state: TransferState.SourceFinalized;
|
|
30
|
+
originTxs: TransactionId<SC>[];
|
|
31
|
+
attestation: AttestationReceipt<PN>;
|
|
32
|
+
}
|
|
33
|
+
export interface AttestedTransferReceipt<PN extends ProtocolName, SC extends Chain = Chain, DC extends Chain = Chain> extends BaseTransferReceipt<PN, SC, DC> {
|
|
34
|
+
state: TransferState.Attested;
|
|
35
|
+
originTxs: TransactionId<SC>[];
|
|
36
|
+
attestation: Required<AttestationReceipt<PN>>;
|
|
37
|
+
}
|
|
38
|
+
export interface CompletedTransferReceipt<PN extends ProtocolName, SC extends Chain = Chain, DC extends Chain = Chain> extends BaseTransferReceipt<PN, SC, DC> {
|
|
39
|
+
state: TransferState.DestinationInitiated | TransferState.DestinationFinalized;
|
|
40
|
+
originTxs: TransactionId<SC>[];
|
|
41
|
+
attestation: AttestationReceipt<PN>;
|
|
42
|
+
destinationTxs?: TransactionId<DC>[];
|
|
43
|
+
}
|
|
44
|
+
export declare function isAttested<PN extends ProtocolName>(receipt: TransferReceipt<PN, Chain, Chain>): receipt is AttestedTransferReceipt<PN, Chain, Chain>;
|
|
45
|
+
export declare function isSourceInitiated<PN extends ProtocolName>(receipt: TransferReceipt<PN, Chain, Chain>): receipt is SourceInitiatedTransferReceipt<PN, Chain, Chain>;
|
|
46
|
+
export declare function isSourceFinalized<PN extends ProtocolName>(receipt: TransferReceipt<PN, Chain, Chain>): receipt is SourceFinalizedTransferReceipt<PN, Chain, Chain>;
|
|
47
|
+
export type TransferReceipt<PN extends ProtocolName, SC extends Chain = Chain, DC extends Chain = Chain> = CreatedTransferReceipt<PN, SC, DC> | SourceInitiatedTransferReceipt<PN, SC, DC> | SourceFinalizedTransferReceipt<PN, SC, DC> | AttestedTransferReceipt<PN, SC, DC> | CompletedTransferReceipt<PN, SC, DC>;
|
|
48
|
+
export type TransferQuote = {
|
|
49
|
+
sourceToken: {
|
|
50
|
+
token: TokenId;
|
|
51
|
+
amount: bigint;
|
|
52
|
+
};
|
|
53
|
+
destinationToken: {
|
|
54
|
+
token: TokenId;
|
|
55
|
+
amount: bigint;
|
|
56
|
+
};
|
|
57
|
+
relayFee?: {
|
|
58
|
+
token: TokenId;
|
|
59
|
+
amount: bigint;
|
|
60
|
+
};
|
|
61
|
+
destinationNativeGas?: bigint;
|
|
62
|
+
};
|
|
63
|
+
export interface TransferProtocol<PN extends ProtocolName> {
|
|
64
|
+
isTransferComplete<N extends Network, P extends Platform, C extends PlatformToChains<P>>(toChain: ChainContext<N, P, C>, attestation: AttestationId<PN>): Promise<boolean>;
|
|
65
|
+
validateTransferDetails<N extends Network>(wh: Wormhole<N>, transfer: TransferRequest<PN>): Promise<void>;
|
|
66
|
+
quoteTransfer(xfer: WormholeTransfer<PN>): Promise<TransferQuote>;
|
|
67
|
+
getReceipt(xfer: WormholeTransfer<PN>): TransferReceipt<PN>;
|
|
68
|
+
track<N extends Network>(wh: Wormhole<N>, xfer: WormholeTransfer<PN>, timeout: number): AsyncGenerator<TransferReceipt<PN>, unknown, unknown>;
|
|
69
|
+
}
|
|
70
|
+
export interface WormholeTransfer<PN extends ProtocolName> {
|
|
71
|
+
transfer: TransferRequest<PN>;
|
|
72
|
+
getTransferState(): TransferState;
|
|
73
|
+
initiateTransfer(signer: Signer): Promise<TxHash[]>;
|
|
74
|
+
fetchAttestation(timeout?: number): Promise<AttestationId[]>;
|
|
75
|
+
completeTransfer(signer: Signer): Promise<TxHash[]>;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=wormholeTransfer.d.ts.map
|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C1D;AAID,MAAM,WAAW,gBAAgB,CAAC,EAAE,SAAS,YAAY;IACvD,QAAQ,EAAE,eAAe,CAAC,EAAE,CAAC,CAAC;IAI9B,gBAAgB,IAAI,aAAa,CAAC;IAIlC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAIpD,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAI7D,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAMrD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSourceFinalized = exports.isSourceInitiated = exports.isAttested = exports.TransferState = void 0;
|
|
4
|
+
// Transfer state machine states
|
|
5
|
+
var TransferState;
|
|
6
|
+
(function (TransferState) {
|
|
7
|
+
TransferState[TransferState["Failed"] = -1] = "Failed";
|
|
8
|
+
TransferState[TransferState["Created"] = 0] = "Created";
|
|
9
|
+
TransferState[TransferState["SourceInitiated"] = 1] = "SourceInitiated";
|
|
10
|
+
TransferState[TransferState["SourceFinalized"] = 2] = "SourceFinalized";
|
|
11
|
+
TransferState[TransferState["Attested"] = 3] = "Attested";
|
|
12
|
+
TransferState[TransferState["DestinationInitiated"] = 4] = "DestinationInitiated";
|
|
13
|
+
TransferState[TransferState["DestinationFinalized"] = 5] = "DestinationFinalized";
|
|
14
|
+
})(TransferState || (exports.TransferState = TransferState = {}));
|
|
15
|
+
function isAttested(receipt) {
|
|
16
|
+
return receipt.state === TransferState.Attested;
|
|
17
|
+
}
|
|
18
|
+
exports.isAttested = isAttested;
|
|
19
|
+
function isSourceInitiated(receipt) {
|
|
20
|
+
return receipt.state === TransferState.SourceInitiated;
|
|
21
|
+
}
|
|
22
|
+
exports.isSourceInitiated = isSourceInitiated;
|
|
23
|
+
function isSourceFinalized(receipt) {
|
|
24
|
+
return receipt.state === TransferState.SourceFinalized;
|
|
25
|
+
}
|
|
26
|
+
exports.isSourceFinalized = isSourceFinalized;
|
|
27
|
+
//# sourceMappingURL=wormholeTransfer.js.map
|