thirdweb 5.99.2 → 5.100.0-nightly-713ebe0a2d6d8a409e41ce0f0317fc34b1f221bb-20250520000414
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/bridge/Buy.js +16 -12
- package/dist/cjs/bridge/Buy.js.map +1 -1
- package/dist/cjs/bridge/Chains.js +2 -2
- package/dist/cjs/bridge/Chains.js.map +1 -1
- package/dist/cjs/bridge/Routes.js +2 -2
- package/dist/cjs/bridge/Routes.js.map +1 -1
- package/dist/cjs/bridge/Sell.js +17 -13
- package/dist/cjs/bridge/Sell.js.map +1 -1
- package/dist/cjs/bridge/Status.js +15 -2
- package/dist/cjs/bridge/Status.js.map +1 -1
- package/dist/cjs/bridge/Transfer.js +229 -0
- package/dist/cjs/bridge/Transfer.js.map +1 -0
- package/dist/cjs/bridge/index.js +2 -1
- package/dist/cjs/bridge/index.js.map +1 -1
- package/dist/cjs/bridge/types/Token.js +3 -0
- package/dist/cjs/bridge/types/Token.js.map +1 -0
- package/dist/cjs/exports/wallets.js +3 -1
- package/dist/cjs/exports/wallets.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getQuote.js +159 -53
- package/dist/cjs/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getStatus.js +160 -14
- package/dist/cjs/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js +95 -37
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js.map +1 -1
- package/dist/cjs/pay/utils/definitions.js +1 -31
- package/dist/cjs/pay/utils/definitions.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +23 -21
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js +2 -15
- package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js +0 -135
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +3 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js +4 -4
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +83 -34
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js +2 -2
- package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
- package/dist/cjs/utils/any-evm/zksync/constants.js +1 -0
- package/dist/cjs/utils/any-evm/zksync/constants.js.map +1 -1
- package/dist/cjs/utils/domains.js +3 -0
- package/dist/cjs/utils/domains.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/injected/mipdStore.js +12 -0
- package/dist/cjs/wallets/injected/mipdStore.js.map +1 -1
- package/dist/esm/bridge/Buy.js +16 -12
- package/dist/esm/bridge/Buy.js.map +1 -1
- package/dist/esm/bridge/Chains.js +2 -2
- package/dist/esm/bridge/Chains.js.map +1 -1
- package/dist/esm/bridge/Routes.js +2 -2
- package/dist/esm/bridge/Routes.js.map +1 -1
- package/dist/esm/bridge/Sell.js +17 -13
- package/dist/esm/bridge/Sell.js.map +1 -1
- package/dist/esm/bridge/Status.js +15 -2
- package/dist/esm/bridge/Status.js.map +1 -1
- package/dist/esm/bridge/Transfer.js +226 -0
- package/dist/esm/bridge/Transfer.js.map +1 -0
- package/dist/esm/bridge/index.js +1 -0
- package/dist/esm/bridge/index.js.map +1 -1
- package/dist/esm/bridge/types/Token.js +2 -0
- package/dist/esm/bridge/types/Token.js.map +1 -0
- package/dist/esm/exports/wallets.js +1 -0
- package/dist/esm/exports/wallets.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getQuote.js +159 -53
- package/dist/esm/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getStatus.js +160 -14
- package/dist/esm/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getTransfer.js +95 -37
- package/dist/esm/pay/buyWithCrypto/getTransfer.js.map +1 -1
- package/dist/esm/pay/utils/definitions.js +0 -25
- package/dist/esm/pay/utils/definitions.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +23 -21
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js +2 -15
- package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js +1 -134
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +3 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +84 -34
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js +2 -2
- package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
- package/dist/esm/utils/any-evm/zksync/constants.js +1 -0
- package/dist/esm/utils/any-evm/zksync/constants.js.map +1 -1
- package/dist/esm/utils/domains.js +3 -0
- package/dist/esm/utils/domains.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/injected/mipdStore.js +11 -0
- package/dist/esm/wallets/injected/mipdStore.js.map +1 -1
- package/dist/types/bridge/Buy.d.ts +10 -8
- package/dist/types/bridge/Buy.d.ts.map +1 -1
- package/dist/types/bridge/Sell.d.ts +12 -10
- package/dist/types/bridge/Sell.d.ts.map +1 -1
- package/dist/types/bridge/Status.d.ts.map +1 -1
- package/dist/types/bridge/Transfer.d.ts +199 -0
- package/dist/types/bridge/Transfer.d.ts.map +1 -0
- package/dist/types/bridge/index.d.ts +1 -0
- package/dist/types/bridge/index.d.ts.map +1 -1
- package/dist/types/bridge/types/Route.d.ts +3 -17
- package/dist/types/bridge/types/Route.d.ts.map +1 -1
- package/dist/types/bridge/types/Status.d.ts +15 -0
- package/dist/types/bridge/types/Status.d.ts.map +1 -1
- package/dist/types/bridge/types/Token.d.ts +10 -0
- package/dist/types/bridge/types/Token.d.ts.map +1 -0
- package/dist/types/exports/wallets.d.ts +1 -0
- package/dist/types/exports/wallets.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/commonTypes.d.ts +0 -9
- package/dist/types/pay/buyWithCrypto/commonTypes.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getTransfer.d.ts.map +1 -1
- package/dist/types/pay/utils/definitions.d.ts +0 -25
- package/dist/types/pay/utils/definitions.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/TransactionsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.d.ts +2 -13
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.d.ts +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts +8 -4
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts.map +1 -1
- package/dist/types/react/web/ui/MediaRenderer/MediaRenderer.d.ts +1 -1
- package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts.map +1 -1
- package/dist/types/utils/any-evm/zksync/constants.d.ts.map +1 -1
- package/dist/types/utils/domains.d.ts +6 -0
- package/dist/types/utils/domains.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/injected/mipdStore.d.ts +7 -0
- package/dist/types/wallets/injected/mipdStore.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bridge/Buy.ts +18 -12
- package/src/bridge/Chains.ts +2 -2
- package/src/bridge/Routes.ts +2 -2
- package/src/bridge/Sell.ts +19 -13
- package/src/bridge/Status.ts +15 -2
- package/src/bridge/Transfer.test.ts +76 -0
- package/src/bridge/Transfer.ts +270 -0
- package/src/bridge/index.ts +1 -0
- package/src/bridge/types/Route.ts +3 -17
- package/src/bridge/types/Status.ts +15 -1
- package/src/bridge/types/Token.ts +10 -0
- package/src/exports/wallets.ts +1 -0
- package/src/extensions/prebuilts/deploy-modular-core.test.ts +2 -1
- package/src/pay/buyWithCrypto/commonTypes.ts +0 -10
- package/src/pay/buyWithCrypto/getQuote.ts +210 -100
- package/src/pay/buyWithCrypto/getStatus.ts +213 -20
- package/src/pay/buyWithCrypto/getTransfer.ts +129 -61
- package/src/pay/utils/definitions.ts +0 -34
- package/src/react/core/hooks/transaction/useSendTransaction.ts +27 -33
- package/src/react/web/ui/ConnectWallet/TransactionsScreen.tsx +29 -35
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +3 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.ts +2 -181
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx +3 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.ts +1 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.ts +118 -63
- package/src/react/web/ui/TransactionButton/ExecutingScreen.tsx +0 -2
- package/src/utils/any-evm/zksync/constants.ts +1 -0
- package/src/utils/domain.test.ts +1 -0
- package/src/utils/domains.ts +8 -0
- package/src/version.ts +1 -1
- package/src/wallets/injected/mipdStore.ts +14 -0
- package/dist/cjs/bridge/constants.js +0 -5
- package/dist/cjs/bridge/constants.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js +0 -54
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js +0 -52
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js.map +0 -1
- package/dist/esm/bridge/constants.js +0 -2
- package/dist/esm/bridge/constants.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js +0 -51
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js +0 -48
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js.map +0 -1
- package/dist/types/bridge/constants.d.ts +0 -2
- package/dist/types/bridge/constants.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.d.ts +0 -10
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.d.ts +0 -9
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.d.ts.map +0 -1
- package/src/bridge/constants.ts +0 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.tsx +0 -163
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx +0 -127
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../../src/utils/domains.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../../src/utils/domains.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAwBlD,eAAO,MAAM,kBAAkB,GAAI,iBAAiB,eAAe,SAalE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;SA1FvB,MAAM;YAKH,MAAM;iBAKD,MAAM;SAKd,MAAM;aAKF,MAAM;aAKN,MAAM;eAKJ,MAAM;aAKR,MAAM;iBAKF,MAAM;YAKX,MAAM;CA+ChB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,eAAe,WAMhE,CAAC;AAIF,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,GAAG,IAAI,SAE/C,CAAC;AAEF,eAAO,MAAM,aAAa,qBAEzB,CAAC"}
|
package/dist/types/version.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare const version = "5.
|
1
|
+
export declare const version = "5.100.0-nightly-713ebe0a2d6d8a409e41ce0f0317fc34b1f221bb-20250520000414";
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,4EAA4E,CAAC"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { type EIP6963ProviderDetail } from "mipd";
|
2
2
|
import type { Ethereum } from "../interfaces/ethereum.js";
|
3
|
+
import type { Wallet } from "../interfaces/wallet.js";
|
3
4
|
import type { WalletId } from "../wallet-types.js";
|
4
5
|
declare module "mipd" {
|
5
6
|
interface Register {
|
@@ -23,5 +24,11 @@ declare module "mipd" {
|
|
23
24
|
* @walletUtils
|
24
25
|
*/
|
25
26
|
export declare function injectedProvider(walletId: WalletId): Ethereum | undefined;
|
27
|
+
/**
|
28
|
+
* Get All currently installed wallets.
|
29
|
+
* Uses EIP-6963 to discover installed browser extension wallets.
|
30
|
+
* @returns a list of installed wallets
|
31
|
+
*/
|
32
|
+
export declare function getInstalledWallets(): Wallet[];
|
26
33
|
export declare function getInstalledWalletProviders(): readonly EIP6963ProviderDetail[];
|
27
34
|
//# sourceMappingURL=mipdStore.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mipdStore.d.ts","sourceRoot":"","sources":["../../../../src/wallets/injected/mipdStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAA2B,MAAM,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"mipdStore.d.ts","sourceRoot":"","sources":["../../../../src/wallets/injected/mipdStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,qBAAqB,EAA2B,MAAM,MAAM,CAAC;AAK3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAiB,QAAQ;QACvB,IAAI,EAAE,QAAQ,CAAC;KAChB;CACF;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAI9C;AAaD,wBAAgB,2BAA2B,IAAI,SAAS,qBAAqB,EAAE,CAY9E"}
|
package/package.json
CHANGED
package/src/bridge/Buy.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { Address as ox__Address } from "ox";
|
2
2
|
import { defineChain } from "../chains/utils.js";
|
3
3
|
import type { ThirdwebClient } from "../client/client.js";
|
4
|
+
import { getThirdwebBaseUrl } from "../utils/domains.js";
|
4
5
|
import { getClientFetch } from "../utils/fetch.js";
|
5
6
|
import { stringify } from "../utils/json.js";
|
6
|
-
import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
7
7
|
import type { PreparedQuote, Quote } from "./types/Quote.js";
|
8
8
|
|
9
9
|
/**
|
@@ -113,12 +113,13 @@ export async function quote(options: quote.Options): Promise<quote.Result> {
|
|
113
113
|
"buyAmountWei" in options ? options.buyAmountWei : options.amount;
|
114
114
|
|
115
115
|
const clientFetch = getClientFetch(client);
|
116
|
-
const url = new URL(`${
|
116
|
+
const url = new URL(`${getThirdwebBaseUrl("bridge")}/v1/buy/quote`);
|
117
117
|
url.searchParams.set("originChainId", originChainId.toString());
|
118
118
|
url.searchParams.set("originTokenAddress", originTokenAddress);
|
119
119
|
url.searchParams.set("destinationChainId", destinationChainId.toString());
|
120
120
|
url.searchParams.set("destinationTokenAddress", destinationTokenAddress);
|
121
121
|
url.searchParams.set("buyAmountWei", amount.toString());
|
122
|
+
url.searchParams.set("amount", amount.toString());
|
122
123
|
if (maxSteps) {
|
123
124
|
url.searchParams.set("maxSteps", maxSteps.toString());
|
124
125
|
}
|
@@ -199,7 +200,7 @@ export declare namespace quote {
|
|
199
200
|
* This will return a quote that might look like:
|
200
201
|
* ```typescript
|
201
202
|
* {
|
202
|
-
* originAmount:
|
203
|
+
* originAmount: 2000030000n,
|
203
204
|
* destinationAmount: 1000000000000000000n,
|
204
205
|
* blockNumber: 22026509n,
|
205
206
|
* timestamp: 1741730936680,
|
@@ -208,11 +209,11 @@ export declare namespace quote {
|
|
208
209
|
* {
|
209
210
|
* originToken: {
|
210
211
|
* chainId: 1,
|
211
|
-
* address: "
|
212
|
-
* symbol: "
|
213
|
-
* name: "
|
214
|
-
* decimals:
|
215
|
-
* priceUsd:
|
212
|
+
* address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
213
|
+
* symbol: "USDC",
|
214
|
+
* name: "USDC",
|
215
|
+
* decimals: 6,
|
216
|
+
* priceUsd: 1,
|
216
217
|
* iconUri: "https://..."
|
217
218
|
* },
|
218
219
|
* destinationToken: {
|
@@ -224,7 +225,7 @@ export declare namespace quote {
|
|
224
225
|
* priceUsd: 2000,
|
225
226
|
* iconUri: "https://..."
|
226
227
|
* },
|
227
|
-
* originAmount:
|
228
|
+
* originAmount: 2000030000n,
|
228
229
|
* destinationAmount: 1000000000000000000n,
|
229
230
|
* estimatedExecutionTimeMs: 1000
|
230
231
|
* transactions: [
|
@@ -250,7 +251,7 @@ export declare namespace quote {
|
|
250
251
|
* expiration: 1741730936680,
|
251
252
|
* intent: {
|
252
253
|
* originChainId: 1,
|
253
|
-
* originTokenAddress: "
|
254
|
+
* originTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
254
255
|
* destinationChainId: 10,
|
255
256
|
* destinationTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
256
257
|
* amount: 1000000000000000000n
|
@@ -334,7 +335,7 @@ export async function prepare(
|
|
334
335
|
} = options;
|
335
336
|
|
336
337
|
const clientFetch = getClientFetch(client);
|
337
|
-
const url = new URL(`${
|
338
|
+
const url = new URL(`${getThirdwebBaseUrl("bridge")}/v1/buy/prepare`);
|
338
339
|
|
339
340
|
const response = await clientFetch(url.toString(), {
|
340
341
|
method: "POST",
|
@@ -342,7 +343,8 @@ export async function prepare(
|
|
342
343
|
"Content-Type": "application/json",
|
343
344
|
},
|
344
345
|
body: stringify({
|
345
|
-
buyAmountWei: amount.toString(),
|
346
|
+
buyAmountWei: amount.toString(), // legacy
|
347
|
+
amount: amount.toString(),
|
346
348
|
originChainId: originChainId.toString(),
|
347
349
|
originTokenAddress,
|
348
350
|
destinationChainId: destinationChainId.toString(),
|
@@ -382,6 +384,8 @@ export async function prepare(
|
|
382
384
|
destinationChainId,
|
383
385
|
destinationTokenAddress,
|
384
386
|
amount,
|
387
|
+
sender,
|
388
|
+
receiver,
|
385
389
|
},
|
386
390
|
};
|
387
391
|
}
|
@@ -407,6 +411,8 @@ export declare namespace prepare {
|
|
407
411
|
destinationChainId: number;
|
408
412
|
destinationTokenAddress: ox__Address.Address;
|
409
413
|
amount: bigint;
|
414
|
+
sender: ox__Address.Address;
|
415
|
+
receiver: ox__Address.Address;
|
410
416
|
purchaseData?: unknown;
|
411
417
|
};
|
412
418
|
};
|
package/src/bridge/Chains.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ThirdwebClient } from "../client/client.js";
|
2
|
+
import { getThirdwebBaseUrl } from "../utils/domains.js";
|
2
3
|
import { getClientFetch } from "../utils/fetch.js";
|
3
|
-
import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
4
4
|
import type { Chain } from "./types/Chain.js";
|
5
5
|
|
6
6
|
/**
|
@@ -54,7 +54,7 @@ export async function chains(options: chains.Options): Promise<chains.Result> {
|
|
54
54
|
const { client } = options;
|
55
55
|
|
56
56
|
const clientFetch = getClientFetch(client);
|
57
|
-
const url = new URL(`${
|
57
|
+
const url = new URL(`${getThirdwebBaseUrl("bridge")}/v1/chains`);
|
58
58
|
|
59
59
|
const response = await clientFetch(url.toString());
|
60
60
|
if (!response.ok) {
|
package/src/bridge/Routes.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Address as ox__Address, Hex as ox__Hex } from "ox";
|
2
2
|
import type { ThirdwebClient } from "../client/client.js";
|
3
|
+
import { getThirdwebBaseUrl } from "../utils/domains.js";
|
3
4
|
import { getClientFetch } from "../utils/fetch.js";
|
4
|
-
import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
5
5
|
import type { Route } from "./types/Route.js";
|
6
6
|
|
7
7
|
/**
|
@@ -133,7 +133,7 @@ export async function routes(options: routes.Options): Promise<routes.Result> {
|
|
133
133
|
} = options;
|
134
134
|
|
135
135
|
const clientFetch = getClientFetch(client);
|
136
|
-
const url = new URL(`${
|
136
|
+
const url = new URL(`${getThirdwebBaseUrl("bridge")}/v1/routes`);
|
137
137
|
if (originChainId) {
|
138
138
|
url.searchParams.set("originChainId", originChainId.toString());
|
139
139
|
}
|
package/src/bridge/Sell.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { Address as ox__Address } from "ox";
|
2
2
|
import { defineChain } from "../chains/utils.js";
|
3
3
|
import type { ThirdwebClient } from "../client/client.js";
|
4
|
+
import { getThirdwebBaseUrl } from "../utils/domains.js";
|
4
5
|
import { getClientFetch } from "../utils/fetch.js";
|
5
6
|
import { stringify } from "../utils/json.js";
|
6
|
-
import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
7
7
|
import type { PreparedQuote, Quote } from "./types/Quote.js";
|
8
8
|
|
9
9
|
/**
|
@@ -112,12 +112,13 @@ export async function quote(options: quote.Options): Promise<quote.Result> {
|
|
112
112
|
} = options;
|
113
113
|
|
114
114
|
const clientFetch = getClientFetch(client);
|
115
|
-
const url = new URL(`${
|
115
|
+
const url = new URL(`${getThirdwebBaseUrl("bridge")}/v1/sell/quote`);
|
116
116
|
url.searchParams.set("originChainId", originChainId.toString());
|
117
117
|
url.searchParams.set("originTokenAddress", originTokenAddress);
|
118
118
|
url.searchParams.set("destinationChainId", destinationChainId.toString());
|
119
119
|
url.searchParams.set("destinationTokenAddress", destinationTokenAddress);
|
120
120
|
url.searchParams.set("sellAmountWei", amount.toString());
|
121
|
+
url.searchParams.set("amount", amount.toString());
|
121
122
|
if (typeof maxSteps !== "undefined") {
|
122
123
|
url.searchParams.set("maxSteps", maxSteps.toString());
|
123
124
|
}
|
@@ -190,7 +191,7 @@ export declare namespace quote {
|
|
190
191
|
* This will return a quote that might look like:
|
191
192
|
* ```typescript
|
192
193
|
* {
|
193
|
-
* originAmount:
|
194
|
+
* originAmount: 2000000000n,
|
194
195
|
* destinationAmount: 9980000000000000000n,
|
195
196
|
* blockNumber: 22026509n,
|
196
197
|
* timestamp: 1741730936680,
|
@@ -199,11 +200,11 @@ export declare namespace quote {
|
|
199
200
|
* {
|
200
201
|
* originToken: {
|
201
202
|
* chainId: 1,
|
202
|
-
* address: "
|
203
|
-
* symbol: "
|
204
|
-
* name: "
|
205
|
-
* decimals:
|
206
|
-
* priceUsd:
|
203
|
+
* address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
204
|
+
* symbol: "USDC",
|
205
|
+
* name: "USDC",
|
206
|
+
* decimals: 6,
|
207
|
+
* priceUsd: 1,
|
207
208
|
* iconUri: "https://..."
|
208
209
|
* },
|
209
210
|
* destinationToken: {
|
@@ -215,7 +216,7 @@ export declare namespace quote {
|
|
215
216
|
* priceUsd: 2000,
|
216
217
|
* iconUri: "https://..."
|
217
218
|
* },
|
218
|
-
* originAmount:
|
219
|
+
* originAmount: 2000000000n,
|
219
220
|
* destinationAmount: 9980000000000000000n,
|
220
221
|
* estimatedExecutionTimeMs: 1000
|
221
222
|
* }
|
@@ -241,10 +242,10 @@ export declare namespace quote {
|
|
241
242
|
* expiration: 1741730936680,
|
242
243
|
* intent: {
|
243
244
|
* originChainId: 1,
|
244
|
-
* originTokenAddress:
|
245
|
+
* originTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
245
246
|
* destinationChainId: 10,
|
246
|
-
* destinationTokenAddress:
|
247
|
-
* amount:
|
247
|
+
* destinationTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
248
|
+
* amount: 2000000000n
|
248
249
|
* }
|
249
250
|
* }
|
250
251
|
* ```
|
@@ -325,7 +326,7 @@ export async function prepare(
|
|
325
326
|
} = options;
|
326
327
|
|
327
328
|
const clientFetch = getClientFetch(client);
|
328
|
-
const url = new URL(`${
|
329
|
+
const url = new URL(`${getThirdwebBaseUrl("bridge")}/v1/sell/prepare`);
|
329
330
|
|
330
331
|
const response = await clientFetch(url.toString(), {
|
331
332
|
method: "POST",
|
@@ -334,6 +335,7 @@ export async function prepare(
|
|
334
335
|
},
|
335
336
|
body: stringify({
|
336
337
|
sellAmountWei: amount.toString(),
|
338
|
+
amount: amount.toString(),
|
337
339
|
originChainId: originChainId.toString(),
|
338
340
|
originTokenAddress,
|
339
341
|
destinationChainId: destinationChainId.toString(),
|
@@ -374,6 +376,8 @@ export async function prepare(
|
|
374
376
|
destinationChainId,
|
375
377
|
destinationTokenAddress,
|
376
378
|
amount,
|
379
|
+
sender,
|
380
|
+
receiver,
|
377
381
|
purchaseData,
|
378
382
|
},
|
379
383
|
};
|
@@ -400,6 +404,8 @@ export declare namespace prepare {
|
|
400
404
|
destinationChainId: number;
|
401
405
|
destinationTokenAddress: ox__Address.Address;
|
402
406
|
amount: bigint;
|
407
|
+
sender: ox__Address.Address;
|
408
|
+
receiver: ox__Address.Address;
|
403
409
|
purchaseData?: unknown;
|
404
410
|
};
|
405
411
|
};
|
package/src/bridge/Status.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { Hex as ox__Hex } from "ox";
|
2
2
|
import type { Chain } from "../chains/types.js";
|
3
3
|
import type { ThirdwebClient } from "../client/client.js";
|
4
|
+
import { getThirdwebBaseUrl } from "../utils/domains.js";
|
4
5
|
import { getClientFetch } from "../utils/fetch.js";
|
5
|
-
import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
|
6
6
|
import type { Status } from "./types/Status.js";
|
7
7
|
|
8
8
|
/**
|
@@ -108,7 +108,7 @@ export async function status(options: status.Options): Promise<status.Result> {
|
|
108
108
|
const chainId = "chainId" in options ? options.chainId : options.chain.id;
|
109
109
|
|
110
110
|
const clientFetch = getClientFetch(client);
|
111
|
-
const url = new URL(`${
|
111
|
+
const url = new URL(`${getThirdwebBaseUrl("bridge")}/v1/status`);
|
112
112
|
url.searchParams.set("transactionHash", transactionHash);
|
113
113
|
url.searchParams.set("chainId", chainId.toString());
|
114
114
|
|
@@ -124,6 +124,7 @@ export async function status(options: status.Options): Promise<status.Result> {
|
|
124
124
|
if (data.status === "FAILED") {
|
125
125
|
return {
|
126
126
|
status: "FAILED",
|
127
|
+
paymentId: data.paymentId,
|
127
128
|
transactions: data.transactions,
|
128
129
|
};
|
129
130
|
}
|
@@ -137,12 +138,19 @@ export async function status(options: status.Options): Promise<status.Result> {
|
|
137
138
|
originTokenAddress: data.originTokenAddress,
|
138
139
|
destinationTokenAddress: data.destinationTokenAddress,
|
139
140
|
transactions: data.transactions,
|
141
|
+
originToken: data.originToken,
|
142
|
+
destinationToken: data.destinationToken,
|
143
|
+
sender: data.sender,
|
144
|
+
receiver: data.receiver,
|
145
|
+
paymentId: data.paymentId,
|
146
|
+
purchaseData: data.purchaseData,
|
140
147
|
};
|
141
148
|
}
|
142
149
|
|
143
150
|
if (data.status === "NOT_FOUND") {
|
144
151
|
return {
|
145
152
|
status: "NOT_FOUND",
|
153
|
+
paymentId: data.paymentId,
|
146
154
|
transactions: [],
|
147
155
|
};
|
148
156
|
}
|
@@ -156,6 +164,11 @@ export async function status(options: status.Options): Promise<status.Result> {
|
|
156
164
|
originTokenAddress: data.originTokenAddress,
|
157
165
|
destinationTokenAddress: data.destinationTokenAddress,
|
158
166
|
transactions: data.transactions,
|
167
|
+
originToken: data.originToken,
|
168
|
+
destinationToken: data.destinationToken,
|
169
|
+
sender: data.sender,
|
170
|
+
receiver: data.receiver,
|
171
|
+
paymentId: data.paymentId,
|
159
172
|
purchaseData: data.purchaseData,
|
160
173
|
};
|
161
174
|
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import { toWei } from "src/utils/units.js";
|
2
|
+
import { describe, expect, it } from "vitest";
|
3
|
+
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
+
import * as Transfer from "./Transfer.js";
|
5
|
+
|
6
|
+
describe.runIf(process.env.TW_SECRET_KEY)("Bridge.Transfer.prepare", () => {
|
7
|
+
it("should get a valid prepared quote", async () => {
|
8
|
+
const quote = await Transfer.prepare({
|
9
|
+
chainId: 1,
|
10
|
+
tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
11
|
+
amount: toWei("0.01"),
|
12
|
+
sender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
|
13
|
+
receiver: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
|
14
|
+
client: TEST_CLIENT,
|
15
|
+
purchaseData: {
|
16
|
+
reference: "test-transfer",
|
17
|
+
},
|
18
|
+
});
|
19
|
+
|
20
|
+
expect(quote).toBeDefined();
|
21
|
+
expect(quote.intent.amount).toEqual(toWei("0.01"));
|
22
|
+
for (const step of quote.steps) {
|
23
|
+
expect(step.transactions.length).toBeGreaterThan(0);
|
24
|
+
}
|
25
|
+
expect(quote.intent).toBeDefined();
|
26
|
+
});
|
27
|
+
|
28
|
+
it("should surface any errors", async () => {
|
29
|
+
await expect(
|
30
|
+
Transfer.prepare({
|
31
|
+
chainId: 444, // Invalid chain ID
|
32
|
+
tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
33
|
+
amount: toWei("1000000000"),
|
34
|
+
sender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
|
35
|
+
receiver: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
|
36
|
+
client: TEST_CLIENT,
|
37
|
+
}),
|
38
|
+
).rejects.toThrowError();
|
39
|
+
});
|
40
|
+
|
41
|
+
it("should support the feePayer option", async () => {
|
42
|
+
const senderQuote = await Transfer.prepare({
|
43
|
+
chainId: 1,
|
44
|
+
tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
45
|
+
amount: toWei("0.01"),
|
46
|
+
sender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
|
47
|
+
receiver: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
|
48
|
+
feePayer: "sender",
|
49
|
+
client: TEST_CLIENT,
|
50
|
+
});
|
51
|
+
|
52
|
+
expect(senderQuote).toBeDefined();
|
53
|
+
expect(senderQuote.intent.feePayer).toBe("sender");
|
54
|
+
|
55
|
+
const receiverQuote = await Transfer.prepare({
|
56
|
+
chainId: 1,
|
57
|
+
tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
58
|
+
amount: toWei("0.01"),
|
59
|
+
sender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
|
60
|
+
receiver: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
|
61
|
+
feePayer: "receiver",
|
62
|
+
client: TEST_CLIENT,
|
63
|
+
});
|
64
|
+
|
65
|
+
expect(receiverQuote).toBeDefined();
|
66
|
+
expect(receiverQuote.intent.feePayer).toBe("receiver");
|
67
|
+
|
68
|
+
// When receiver pays fees, the destination amount should be less than the requested amount
|
69
|
+
expect(receiverQuote.destinationAmount).toBeLessThan(toWei("0.01"));
|
70
|
+
|
71
|
+
// When sender pays fees, the origin amount should be more than the requested amount
|
72
|
+
// and the destination amount should equal the requested amount
|
73
|
+
expect(senderQuote.originAmount).toBeGreaterThan(toWei("0.01"));
|
74
|
+
expect(senderQuote.destinationAmount).toEqual(toWei("0.01"));
|
75
|
+
});
|
76
|
+
});
|