thirdweb 5.92.3 → 5.93.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/adapters/eip1193/from-eip1193.js +7 -9
- package/dist/cjs/adapters/eip1193/from-eip1193.js.map +1 -1
- package/dist/cjs/bridge/Buy.js +199 -0
- package/dist/cjs/bridge/Buy.js.map +1 -0
- package/dist/cjs/bridge/Routes.js +134 -0
- package/dist/cjs/bridge/Routes.js.map +1 -0
- package/dist/cjs/bridge/Sell.js +199 -0
- package/dist/cjs/bridge/Sell.js.map +1 -0
- package/dist/cjs/bridge/Status.js +147 -0
- package/dist/cjs/bridge/Status.js.map +1 -0
- package/dist/cjs/bridge/constants.js +5 -0
- package/dist/cjs/bridge/constants.js.map +1 -0
- package/dist/cjs/bridge/index.js +10 -0
- package/dist/cjs/bridge/index.js.map +1 -0
- package/dist/cjs/bridge/types/Quote.js +3 -0
- package/dist/cjs/bridge/types/Quote.js.map +1 -0
- package/dist/cjs/bridge/types/Route.js +3 -0
- package/dist/cjs/bridge/types/Route.js.map +1 -0
- package/dist/cjs/bridge/types/Status.js +3 -0
- package/dist/cjs/bridge/types/Status.js.map +1 -0
- package/dist/cjs/exports/bridge.js +5 -0
- package/dist/cjs/exports/bridge.js.map +1 -0
- package/dist/cjs/exports/thirdweb.js +6 -2
- package/dist/cjs/exports/thirdweb.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +1 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js +11 -8
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/adapters/eip1193/from-eip1193.js +7 -9
- package/dist/esm/adapters/eip1193/from-eip1193.js.map +1 -1
- package/dist/esm/bridge/Buy.js +195 -0
- package/dist/esm/bridge/Buy.js.map +1 -0
- package/dist/esm/bridge/Routes.js +131 -0
- package/dist/esm/bridge/Routes.js.map +1 -0
- package/dist/esm/bridge/Sell.js +195 -0
- package/dist/esm/bridge/Sell.js.map +1 -0
- package/dist/esm/bridge/Status.js +144 -0
- package/dist/esm/bridge/Status.js.map +1 -0
- package/dist/esm/bridge/constants.js +2 -0
- package/dist/esm/bridge/constants.js.map +1 -0
- package/dist/esm/bridge/index.js +5 -0
- package/dist/esm/bridge/index.js.map +1 -0
- package/dist/esm/bridge/types/Quote.js +2 -0
- package/dist/esm/bridge/types/Quote.js.map +1 -0
- package/dist/esm/bridge/types/Route.js +2 -0
- package/dist/esm/bridge/types/Route.js.map +1 -0
- package/dist/esm/bridge/types/Status.js +2 -0
- package/dist/esm/bridge/types/Status.js.map +1 -0
- package/dist/esm/exports/bridge.js +2 -0
- package/dist/esm/exports/bridge.js.map +1 -0
- package/dist/esm/exports/thirdweb.js +4 -0
- package/dist/esm/exports/thirdweb.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +1 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js +12 -9
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/adapters/eip1193/from-eip1193.d.ts +3 -1
- package/dist/types/adapters/eip1193/from-eip1193.d.ts.map +1 -1
- package/dist/types/bridge/Buy.d.ts +171 -0
- package/dist/types/bridge/Buy.d.ts.map +1 -0
- package/dist/types/bridge/Routes.d.ts +116 -0
- package/dist/types/bridge/Routes.d.ts.map +1 -0
- package/dist/types/bridge/Sell.d.ts +171 -0
- package/dist/types/bridge/Sell.d.ts.map +1 -0
- package/dist/types/bridge/Status.d.ts +108 -0
- package/dist/types/bridge/Status.d.ts.map +1 -0
- package/dist/types/bridge/constants.d.ts +2 -0
- package/dist/types/bridge/constants.d.ts.map +1 -0
- package/dist/types/bridge/index.d.ts +8 -0
- package/dist/types/bridge/index.d.ts.map +1 -0
- package/dist/types/bridge/types/Quote.d.ts +34 -0
- package/dist/types/bridge/types/Quote.d.ts.map +1 -0
- package/dist/types/bridge/types/Route.d.ts +20 -0
- package/dist/types/bridge/types/Route.d.ts.map +1 -0
- package/dist/types/bridge/types/Status.d.ts +35 -0
- package/dist/types/bridge/types/Status.d.ts.map +1 -0
- package/dist/types/exports/bridge.d.ts +2 -0
- package/dist/types/exports/bridge.d.ts.map +1 -0
- package/dist/types/exports/thirdweb.d.ts +4 -0
- package/dist/types/exports/thirdweb.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.d.ts +1 -3
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +9 -1
- package/src/adapters/eip1193/from-eip1193.ts +10 -10
- package/src/bridge/Buy.test.ts +74 -0
- package/src/bridge/Buy.ts +267 -0
- package/src/bridge/Routes.test.ts +161 -0
- package/src/bridge/Routes.ts +160 -0
- package/src/bridge/Sell.test.ts +74 -0
- package/src/bridge/Sell.ts +267 -0
- package/src/bridge/Status.test.ts +38 -0
- package/src/bridge/Status.ts +163 -0
- package/src/bridge/constants.ts +1 -0
- package/src/bridge/index.ts +8 -0
- package/src/bridge/types/Quote.ts +42 -0
- package/src/bridge/types/Route.ts +20 -0
- package/src/bridge/types/Status.ts +39 -0
- package/src/exports/bridge.ts +1 -0
- package/src/exports/thirdweb.ts +5 -0
- package/src/react/web/ui/ConnectWallet/WalletSelector.tsx +2 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +1 -6
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.tsx +14 -35
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.tsx +1 -1
- package/src/version.ts +1 -1
@@ -0,0 +1,171 @@
|
|
1
|
+
import type { Address as ox__Address } from "ox";
|
2
|
+
import type { ThirdwebClient } from "../client/client.js";
|
3
|
+
import type { PreparedQuote, Quote } from "./types/Quote.js";
|
4
|
+
/**
|
5
|
+
* Retrieves a Universal Bridge quote for the provided buy intent. The quote will specify the necessary `originAmount` to receive the desired `destinationAmount`, which is specified with the `buyAmountWei` option.
|
6
|
+
*
|
7
|
+
* @example
|
8
|
+
* ```typescript
|
9
|
+
* import { Bridge, NATIVE_TOKEN_ADDRESS } from "thirdweb";
|
10
|
+
*
|
11
|
+
* const quote = await Bridge.Buy.quote({
|
12
|
+
* originChainId: 1,
|
13
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
14
|
+
* destinationChainId: 10,
|
15
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
16
|
+
* buyAmountWei: toWei("0.01"),
|
17
|
+
* client: thirdwebClient,
|
18
|
+
* });
|
19
|
+
* ```
|
20
|
+
*
|
21
|
+
* This will return a quote that might look like:
|
22
|
+
* ```typescript
|
23
|
+
* {
|
24
|
+
* originAmount: 10000026098875381n,
|
25
|
+
* destinationAmount: 1000000000000000000n,
|
26
|
+
* blockNumber: 22026509n,
|
27
|
+
* timestamp: 1741730936680,
|
28
|
+
* estimatedExecutionTimeMs: 1000
|
29
|
+
* intent: {
|
30
|
+
* originChainId: 1,
|
31
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
32
|
+
* destinationChainId: 10,
|
33
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
34
|
+
* buyAmountWei: 1000000000000000000n
|
35
|
+
* }
|
36
|
+
* }
|
37
|
+
* ```
|
38
|
+
*
|
39
|
+
* The quote is an **estimate** for how much you would expect to pay for a specific buy. This quote is not guaranteed and you should use `Buy.prepare` to get a finalized quote with transaction data ready for execution.
|
40
|
+
* So why use `quote`? The quote function is sometimes slightly faster than `prepare`, and can be used before the user connects their wallet.
|
41
|
+
*
|
42
|
+
* You can access this functions input and output types with `Buy.quote.Options` and `Buy.quote.Result`, respectively.
|
43
|
+
*
|
44
|
+
* @param options - The options for the quote.
|
45
|
+
* @param options.originChainId - The chain ID of the origin token.
|
46
|
+
* @param options.originTokenAddress - The address of the origin token.
|
47
|
+
* @param options.destinationChainId - The chain ID of the destination token.
|
48
|
+
* @param options.destinationTokenAddress - The address of the destination token.
|
49
|
+
* @param options.buyAmountWei - The amount of the origin token to buy.
|
50
|
+
* @param options.client - Your thirdweb client.
|
51
|
+
*
|
52
|
+
* @returns A promise that resolves to a non-finalized quote for the requested buy.
|
53
|
+
*
|
54
|
+
* @throws Will throw an error if there is an issue fetching the quote.
|
55
|
+
* @bridge
|
56
|
+
* @beta
|
57
|
+
*/
|
58
|
+
export declare function quote(options: quote.Options): Promise<quote.Result>;
|
59
|
+
export declare namespace quote {
|
60
|
+
type Options = {
|
61
|
+
originChainId: number;
|
62
|
+
originTokenAddress: ox__Address.Address;
|
63
|
+
destinationChainId: number;
|
64
|
+
destinationTokenAddress: ox__Address.Address;
|
65
|
+
buyAmountWei: bigint;
|
66
|
+
client: ThirdwebClient;
|
67
|
+
};
|
68
|
+
type Result = Quote & {
|
69
|
+
intent: {
|
70
|
+
originChainId: number;
|
71
|
+
originTokenAddress: ox__Address.Address;
|
72
|
+
destinationChainId: number;
|
73
|
+
destinationTokenAddress: ox__Address.Address;
|
74
|
+
buyAmountWei: bigint;
|
75
|
+
};
|
76
|
+
};
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Prepares a **finalized** Universal Bridge quote for the provided buy request with transaction data. This function will return everything `quote` does, with the addition of a series of prepared transactions and the associated expiration timestamp.
|
80
|
+
*
|
81
|
+
* @example
|
82
|
+
* ```typescript
|
83
|
+
* import { Bridge, NATIVE_TOKEN_ADDRESS } from "thirdweb";
|
84
|
+
*
|
85
|
+
* const quote = await Bridge.Buy.prepare({
|
86
|
+
* originChainId: 1,
|
87
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
88
|
+
* destinationChainId: 10,
|
89
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
90
|
+
* buyAmountWei: toWei("0.01"),
|
91
|
+
* client: thirdwebClient,
|
92
|
+
* });
|
93
|
+
* ```
|
94
|
+
*
|
95
|
+
* This will return a quote that might look like:
|
96
|
+
* ```typescript
|
97
|
+
* {
|
98
|
+
* originAmount: 10000026098875381n,
|
99
|
+
* destinationAmount: 1000000000000000000n,
|
100
|
+
* blockNumber: 22026509n,
|
101
|
+
* timestamp: 1741730936680,
|
102
|
+
* estimatedExecutionTimeMs: 1000
|
103
|
+
* transactions: [
|
104
|
+
* {
|
105
|
+
* to: NATIVE_TOKEN_ADDRESS,
|
106
|
+
* value: 10000026098875381n,
|
107
|
+
* data: "0x",
|
108
|
+
* chainId: 10,
|
109
|
+
* type: "eip1559"
|
110
|
+
* }
|
111
|
+
* ],
|
112
|
+
* expiration: 1741730936680,
|
113
|
+
* intent: {
|
114
|
+
* originChainId: 1,
|
115
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
116
|
+
* destinationChainId: 10,
|
117
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
118
|
+
* buyAmountWei: 1000000000000000000n
|
119
|
+
* }
|
120
|
+
* }
|
121
|
+
* ```
|
122
|
+
*
|
123
|
+
* ## Sending the transactions
|
124
|
+
* The `transactions` array is a series of [ox](https://oxlib.sh) EIP-1559 transactions that must be executed one after the other in order to fulfill the complete route. There are a few things to keep in mind when executing these transactions:
|
125
|
+
* - Approvals and other preparation transactions are not included in the transactions array.
|
126
|
+
* - All transactions are assumed to be executed by the `sender` address, regardless of which chain they are on. The final transaction will use the `receiver` as the recipient address.
|
127
|
+
* - If an `expiration` timestamp is provided, all transactions must be executed before that time to guarantee successful execution at the specified price.
|
128
|
+
*
|
129
|
+
* NOTE: To get the status of each transaction, use `Bridge.status` rather than checking for transaction inclusion. This function will ensure full bridge completion on the destination chain.
|
130
|
+
*
|
131
|
+
* You can access this functions input and output types with `Buy.prepare.Options` and `Buy.prepare.Result`, respectively.
|
132
|
+
*
|
133
|
+
* @param options - The options for the quote.
|
134
|
+
* @param options.originChainId - The chain ID of the origin token.
|
135
|
+
* @param options.originTokenAddress - The address of the origin token.
|
136
|
+
* @param options.destinationChainId - The chain ID of the destination token.
|
137
|
+
* @param options.destinationTokenAddress - The address of the destination token.
|
138
|
+
* @param options.buyAmountWei - The amount of the origin token to buy.
|
139
|
+
* @param options.sender - The address of the sender.
|
140
|
+
* @param options.receiver - The address of the recipient.
|
141
|
+
* @param options.client - Your thirdweb client.
|
142
|
+
*
|
143
|
+
* @returns A promise that resolves to a non-finalized quote for the requested buy.
|
144
|
+
*
|
145
|
+
* @throws Will throw an error if there is an issue fetching the quote.
|
146
|
+
* @bridge
|
147
|
+
* @beta
|
148
|
+
*/
|
149
|
+
export declare function prepare(options: prepare.Options): Promise<prepare.Result>;
|
150
|
+
export declare namespace prepare {
|
151
|
+
type Options = {
|
152
|
+
originChainId: number;
|
153
|
+
originTokenAddress: ox__Address.Address;
|
154
|
+
destinationChainId: number;
|
155
|
+
destinationTokenAddress: ox__Address.Address;
|
156
|
+
buyAmountWei: bigint;
|
157
|
+
sender: ox__Address.Address;
|
158
|
+
receiver: ox__Address.Address;
|
159
|
+
client: ThirdwebClient;
|
160
|
+
};
|
161
|
+
type Result = PreparedQuote & {
|
162
|
+
intent: {
|
163
|
+
originChainId: number;
|
164
|
+
originTokenAddress: ox__Address.Address;
|
165
|
+
destinationChainId: number;
|
166
|
+
destinationTokenAddress: ox__Address.Address;
|
167
|
+
buyAmountWei: bigint;
|
168
|
+
};
|
169
|
+
};
|
170
|
+
}
|
171
|
+
//# sourceMappingURL=Buy.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Buy.d.ts","sourceRoot":"","sources":["../../../src/bridge/Buy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,IAAI,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAuCzE;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,KAAK,OAAO,GAAG;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,kBAAkB,EAAE,WAAW,CAAC,OAAO,CAAC;QACxC,kBAAkB,EAAE,MAAM,CAAC;QAC3B,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC;QAC7C,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,cAAc,CAAC;KACxB,CAAC;IAEF,KAAK,MAAM,GAAG,KAAK,GAAG;QACpB,MAAM,EAAE;YACN,aAAa,EAAE,MAAM,CAAC;YACtB,kBAAkB,EAAE,WAAW,CAAC,OAAO,CAAC;YACxC,kBAAkB,EAAE,MAAM,CAAC;YAC3B,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC;YAC7C,YAAY,EAAE,MAAM,CAAC;SACtB,CAAC;KACH,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,OAAO,CAAC,OAAO,GACvB,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAgDzB;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,KAAK,OAAO,GAAG;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,kBAAkB,EAAE,WAAW,CAAC,OAAO,CAAC;QACxC,kBAAkB,EAAE,MAAM,CAAC;QAC3B,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC;QAC7C,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC;QAC5B,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC;QAC9B,MAAM,EAAE,cAAc,CAAC;KACxB,CAAC;IAEF,KAAK,MAAM,GAAG,aAAa,GAAG;QAC5B,MAAM,EAAE;YACN,aAAa,EAAE,MAAM,CAAC;YACtB,kBAAkB,EAAE,WAAW,CAAC,OAAO,CAAC;YACxC,kBAAkB,EAAE,MAAM,CAAC;YAC3B,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC;YAC7C,YAAY,EAAE,MAAM,CAAC;SACtB,CAAC;KACH,CAAC;CACH"}
|
@@ -0,0 +1,116 @@
|
|
1
|
+
import type { Address as ox__Address, Hex as ox__Hex } from "ox";
|
2
|
+
import type { ThirdwebClient } from "../client/client.js";
|
3
|
+
import type { Route } from "./types/Route.js";
|
4
|
+
/**
|
5
|
+
* Retrieves supported Universal Bridge routes based on the provided filters.
|
6
|
+
*
|
7
|
+
* When multiple filters are specified, a route must satisfy all filters to be included (it acts as an AND operator).
|
8
|
+
*
|
9
|
+
* @example
|
10
|
+
* ```typescript
|
11
|
+
* import { Bridge } from "thirdweb";
|
12
|
+
*
|
13
|
+
* const routes = await Bridge.routes({
|
14
|
+
* client: thirdwebClient,
|
15
|
+
* });
|
16
|
+
* ```
|
17
|
+
*
|
18
|
+
* Returned routes might look something like:
|
19
|
+
* ```typescript
|
20
|
+
* [
|
21
|
+
* {
|
22
|
+
* destinationToken: {
|
23
|
+
* address: "0x12c88a3C30A7AaBC1dd7f2c08a97145F5DCcD830",
|
24
|
+
* chainId: 1,
|
25
|
+
* decimals: 18,
|
26
|
+
* iconUri: "https://assets.coingecko.com/coins/images/37207/standard/G.jpg",
|
27
|
+
* name: "G7",
|
28
|
+
* symbol: "G7",
|
29
|
+
* },
|
30
|
+
* originToken: {
|
31
|
+
* address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
32
|
+
* chainId: 480,
|
33
|
+
* decimals: 18,
|
34
|
+
* iconUri: "https://assets.relay.link/icons/1/light.png",
|
35
|
+
* name: "Ether",
|
36
|
+
* symbol: "ETH",
|
37
|
+
* }
|
38
|
+
* },
|
39
|
+
* {
|
40
|
+
* destinationToken: {
|
41
|
+
* address: "0x4d224452801ACEd8B2F0aebE155379bb5D594381",
|
42
|
+
* chainId: 1,
|
43
|
+
* decimals: 18,
|
44
|
+
* iconUri: "https://coin-images.coingecko.com/coins/images/24383/large/apecoin.jpg?1696523566",
|
45
|
+
* name: "ApeCoin",
|
46
|
+
* symbol: "APE",
|
47
|
+
* },
|
48
|
+
* originToken: {
|
49
|
+
* address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
50
|
+
* chainId: 480,
|
51
|
+
* decimals: 18,
|
52
|
+
* iconUri: "https://assets.relay.link/icons/1/light.png",
|
53
|
+
* name: "Ether",
|
54
|
+
* symbol: "ETH",
|
55
|
+
* }
|
56
|
+
* }
|
57
|
+
* ]
|
58
|
+
* ```
|
59
|
+
*
|
60
|
+
* You can filter for specific chains or tokens:
|
61
|
+
* ```typescript
|
62
|
+
* import { Bridge } from "thirdweb";
|
63
|
+
*
|
64
|
+
* // Get all routes starting from mainnet ETH
|
65
|
+
* const routes = await Bridge.routes({
|
66
|
+
* originChainId: 1,
|
67
|
+
* originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
68
|
+
* client: thirdwebClient,
|
69
|
+
* });
|
70
|
+
* ```
|
71
|
+
*
|
72
|
+
* The returned routes will be limited based on the API. You can paginate through the results using the `limit` and `offset` parameters:
|
73
|
+
* ```typescript
|
74
|
+
* import { Bridge } from "thirdweb";
|
75
|
+
*
|
76
|
+
* // Get the first 10 routes starting from mainnet ETH
|
77
|
+
* const routes = await Bridge.routes({
|
78
|
+
* originChainId: 1,
|
79
|
+
* originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
80
|
+
* limit: 10,
|
81
|
+
* offset: 0,
|
82
|
+
* client: thirdwebClient,
|
83
|
+
* });
|
84
|
+
* ```
|
85
|
+
*
|
86
|
+
* @param options - The options for the quote.
|
87
|
+
* @param options.client - Your thirdweb client.
|
88
|
+
* @param options.originChainId - Filter by a specific origin chain ID.
|
89
|
+
* @param options.originTokenAddress - Filter by a specific origin token address.
|
90
|
+
* @param options.destinationChainId - Filter by a specific destination chain ID.
|
91
|
+
* @param options.destinationTokenAddress - Filter by a specific destination token address.
|
92
|
+
* @param options.transactionHash - Filter by a specific transaction hash.
|
93
|
+
* @param options.limit - Limit the number of routes returned.
|
94
|
+
* @param options.offset - Offset the number of routes returned.
|
95
|
+
*
|
96
|
+
* @returns A promise that resolves to an array of routes.
|
97
|
+
*
|
98
|
+
* @throws Will throw an error if there is an issue fetching the routes.
|
99
|
+
* @bridge
|
100
|
+
* @beta
|
101
|
+
*/
|
102
|
+
export declare function routes(options: routes.Options): Promise<routes.Result>;
|
103
|
+
export declare namespace routes {
|
104
|
+
type Options = {
|
105
|
+
client: ThirdwebClient;
|
106
|
+
originChainId?: number;
|
107
|
+
originTokenAddress?: ox__Address.Address;
|
108
|
+
destinationChainId?: number;
|
109
|
+
destinationTokenAddress?: ox__Address.Address;
|
110
|
+
transactionHash?: ox__Hex.Hex;
|
111
|
+
limit?: number;
|
112
|
+
offset?: number;
|
113
|
+
};
|
114
|
+
type Result = Route[];
|
115
|
+
}
|
116
|
+
//# sourceMappingURL=Routes.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Routes.d.ts","sourceRoot":"","sources":["../../../src/bridge/Routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,IAAI,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAwC5E;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,KAAK,OAAO,GAAG;QACb,MAAM,EAAE,cAAc,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,kBAAkB,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC;QACzC,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,uBAAuB,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC;QAC9C,eAAe,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC;QAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,KAAK,MAAM,GAAG,KAAK,EAAE,CAAC;CACvB"}
|
@@ -0,0 +1,171 @@
|
|
1
|
+
import type { Address as ox__Address } from "ox";
|
2
|
+
import type { ThirdwebClient } from "../client/client.js";
|
3
|
+
import type { PreparedQuote, Quote } from "./types/Quote.js";
|
4
|
+
/**
|
5
|
+
* Retrieves a Universal Bridge quote for the provided sell intent. The quote will specify the expected `destinationAmount` that will be received in exchange for the specified `originAmount`, which is specified with the `sellAmountWei` option.
|
6
|
+
*
|
7
|
+
* @example
|
8
|
+
* ```typescript
|
9
|
+
* import { Bridge, NATIVE_TOKEN_ADDRESS } from "thirdweb";
|
10
|
+
*
|
11
|
+
* const quote = await Bridge.Sell.quote({
|
12
|
+
* originChainId: 1,
|
13
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
14
|
+
* destinationChainId: 10,
|
15
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
16
|
+
* sellAmountWei: toWei("0.01"),
|
17
|
+
* client: thirdwebClient,
|
18
|
+
* });
|
19
|
+
* ```
|
20
|
+
*
|
21
|
+
* This will return a quote that might look like:
|
22
|
+
* ```typescript
|
23
|
+
* {
|
24
|
+
* originAmount: 1000000000000000000n,
|
25
|
+
* destinationAmount: 9999979011973735n,
|
26
|
+
* blockNumber: 22026509n,
|
27
|
+
* timestamp: 1741730936680,
|
28
|
+
* estimatedExecutionTimeMs: 1000
|
29
|
+
* intent: {
|
30
|
+
* originChainId: 1,
|
31
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
32
|
+
* destinationChainId: 10,
|
33
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
34
|
+
* sellAmountWei: 1000000000000000000n
|
35
|
+
* }
|
36
|
+
* }
|
37
|
+
* ```
|
38
|
+
*
|
39
|
+
* The quote is an **estimate** for how much you would expect to receive for a specific sell. This quote is not guaranteed and you should use `Sell.prepare` to get a finalized quote with transaction data ready for execution.
|
40
|
+
* So why use `quote`? The quote function is sometimes slightly faster than `prepare`, and can be used before the user connects their wallet.
|
41
|
+
*
|
42
|
+
* You can access this functions input and output types with `Sell.quote.Options` and `Sell.quote.Result`, respectively.
|
43
|
+
*
|
44
|
+
* @param options - The options for the quote.
|
45
|
+
* @param options.originChainId - The chain ID of the origin token.
|
46
|
+
* @param options.originTokenAddress - The address of the origin token.
|
47
|
+
* @param options.destinationChainId - The chain ID of the destination token.
|
48
|
+
* @param options.destinationTokenAddress - The address of the destination token.
|
49
|
+
* @param options.sellAmountWei - The amount of the origin token to sell.
|
50
|
+
* @param options.client - Your thirdweb client.
|
51
|
+
*
|
52
|
+
* @returns A promise that resolves to a non-finalized quote for the requested sell.
|
53
|
+
*
|
54
|
+
* @throws Will throw an error if there is an issue fetching the quote.
|
55
|
+
* @bridge
|
56
|
+
* @beta
|
57
|
+
*/
|
58
|
+
export declare function quote(options: quote.Options): Promise<quote.Result>;
|
59
|
+
export declare namespace quote {
|
60
|
+
type Options = {
|
61
|
+
originChainId: number;
|
62
|
+
originTokenAddress: ox__Address.Address;
|
63
|
+
destinationChainId: number;
|
64
|
+
destinationTokenAddress: ox__Address.Address;
|
65
|
+
sellAmountWei: bigint;
|
66
|
+
client: ThirdwebClient;
|
67
|
+
};
|
68
|
+
type Result = Quote & {
|
69
|
+
intent: {
|
70
|
+
originChainId: number;
|
71
|
+
originTokenAddress: ox__Address.Address;
|
72
|
+
destinationChainId: number;
|
73
|
+
destinationTokenAddress: ox__Address.Address;
|
74
|
+
sellAmountWei: bigint;
|
75
|
+
};
|
76
|
+
};
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Prepares a **finalized** Universal Bridge quote for the provided sell request with transaction data. This function will return everything `quote` does, with the addition of a series of prepared transactions and the associated expiration timestamp.
|
80
|
+
*
|
81
|
+
* @example
|
82
|
+
* ```typescript
|
83
|
+
* import { Bridge, NATIVE_TOKEN_ADDRESS } from "thirdweb";
|
84
|
+
*
|
85
|
+
* const quote = await Bridge.Sell.prepare({
|
86
|
+
* originChainId: 1,
|
87
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
88
|
+
* destinationChainId: 10,
|
89
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
90
|
+
* sellAmountWei: toWei("0.01"),
|
91
|
+
* client: thirdwebClient,
|
92
|
+
* });
|
93
|
+
* ```
|
94
|
+
*
|
95
|
+
* This will return a quote that might look like:
|
96
|
+
* ```typescript
|
97
|
+
* {
|
98
|
+
* originAmount: 1000000000000000000n,
|
99
|
+
* destinationAmount: 9980000000000000000n,
|
100
|
+
* blockNumber: 22026509n,
|
101
|
+
* timestamp: 1741730936680,
|
102
|
+
* estimatedExecutionTimeMs: 1000
|
103
|
+
* transactions: [
|
104
|
+
* {
|
105
|
+
* to: NATIVE_TOKEN_ADDRESS,
|
106
|
+
* value: 9980000000000000000n,
|
107
|
+
* data: "0x",
|
108
|
+
* chainId: 10,
|
109
|
+
* type: "eip1559"
|
110
|
+
* }
|
111
|
+
* ],
|
112
|
+
* expiration: 1741730936680,
|
113
|
+
* intent: {
|
114
|
+
* originChainId: 1,
|
115
|
+
* originTokenAddress: NATIVE_TOKEN_ADDRESS,
|
116
|
+
* destinationChainId: 10,
|
117
|
+
* destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
|
118
|
+
* sellAmountWei: 1000000000000000000n
|
119
|
+
* }
|
120
|
+
* }
|
121
|
+
* ```
|
122
|
+
*
|
123
|
+
* ## Sending the transactions
|
124
|
+
* The `transactions` array is a series of [ox](https://oxlib.sh) EIP-1559 transactions that must be executed one after the other in order to fulfill the complete route. There are a few things to keep in mind when executing these transactions:
|
125
|
+
* - Approvals and other preparation transactions are not included in the transactions array.
|
126
|
+
* - All transactions are assumed to be executed by the `sender` address, regardless of which chain they are on. The final transaction will use the `receiver` as the recipient address.
|
127
|
+
* - If an `expiration` timestamp is provided, all transactions must be executed before that time to guarantee successful execution at the specified price.
|
128
|
+
*
|
129
|
+
* NOTE: To get the status of each transaction, use `Bridge.status` rather than checking for transaction inclusion. This function will ensure full bridge completion on the destination chain.
|
130
|
+
*
|
131
|
+
* You can access this functions input and output types with `Sell.prepare.Options` and `Sell.prepare.Result`, respectively.
|
132
|
+
*
|
133
|
+
* @param options - The options for the quote.
|
134
|
+
* @param options.originChainId - The chain ID of the origin token.
|
135
|
+
* @param options.originTokenAddress - The address of the origin token.
|
136
|
+
* @param options.destinationChainId - The chain ID of the destination token.
|
137
|
+
* @param options.destinationTokenAddress - The address of the destination token.
|
138
|
+
* @param options.sellAmountWei - The amount of the origin token to sell.
|
139
|
+
* @param options.sender - The address of the sender.
|
140
|
+
* @param options.receiver - The address of the recipient.
|
141
|
+
* @param options.client - Your thirdweb client.
|
142
|
+
*
|
143
|
+
* @returns A promise that resolves to a non-finalized quote for the requested buy.
|
144
|
+
*
|
145
|
+
* @throws Will throw an error if there is an issue fetching the quote.
|
146
|
+
* @bridge
|
147
|
+
* @beta
|
148
|
+
*/
|
149
|
+
export declare function prepare(options: prepare.Options): Promise<prepare.Result>;
|
150
|
+
export declare namespace prepare {
|
151
|
+
type Options = {
|
152
|
+
originChainId: number;
|
153
|
+
originTokenAddress: ox__Address.Address;
|
154
|
+
destinationChainId: number;
|
155
|
+
destinationTokenAddress: ox__Address.Address;
|
156
|
+
sellAmountWei: bigint;
|
157
|
+
sender: ox__Address.Address;
|
158
|
+
receiver: ox__Address.Address;
|
159
|
+
client: ThirdwebClient;
|
160
|
+
};
|
161
|
+
type Result = PreparedQuote & {
|
162
|
+
intent: {
|
163
|
+
originChainId: number;
|
164
|
+
originTokenAddress: ox__Address.Address;
|
165
|
+
destinationChainId: number;
|
166
|
+
destinationTokenAddress: ox__Address.Address;
|
167
|
+
sellAmountWei: bigint;
|
168
|
+
};
|
169
|
+
};
|
170
|
+
}
|
171
|
+
//# sourceMappingURL=Sell.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Sell.d.ts","sourceRoot":"","sources":["../../../src/bridge/Sell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,IAAI,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAuCzE;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,KAAK,OAAO,GAAG;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,kBAAkB,EAAE,WAAW,CAAC,OAAO,CAAC;QACxC,kBAAkB,EAAE,MAAM,CAAC;QAC3B,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC;QAC7C,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,cAAc,CAAC;KACxB,CAAC;IAEF,KAAK,MAAM,GAAG,KAAK,GAAG;QACpB,MAAM,EAAE;YACN,aAAa,EAAE,MAAM,CAAC;YACtB,kBAAkB,EAAE,WAAW,CAAC,OAAO,CAAC;YACxC,kBAAkB,EAAE,MAAM,CAAC;YAC3B,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC;YAC7C,aAAa,EAAE,MAAM,CAAC;SACvB,CAAC;KACH,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,OAAO,CAAC,OAAO,GACvB,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAgDzB;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,KAAK,OAAO,GAAG;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,kBAAkB,EAAE,WAAW,CAAC,OAAO,CAAC;QACxC,kBAAkB,EAAE,MAAM,CAAC;QAC3B,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC;QAC7C,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC;QAC5B,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC;QAC9B,MAAM,EAAE,cAAc,CAAC;KACxB,CAAC;IAEF,KAAK,MAAM,GAAG,aAAa,GAAG;QAC5B,MAAM,EAAE;YACN,aAAa,EAAE,MAAM,CAAC;YACtB,kBAAkB,EAAE,WAAW,CAAC,OAAO,CAAC;YACxC,kBAAkB,EAAE,MAAM,CAAC;YAC3B,uBAAuB,EAAE,WAAW,CAAC,OAAO,CAAC;YAC7C,aAAa,EAAE,MAAM,CAAC;SACvB,CAAC;KACH,CAAC;CACH"}
|
@@ -0,0 +1,108 @@
|
|
1
|
+
import type { Hex as ox__Hex } from "ox";
|
2
|
+
import type { ThirdwebClient } from "../client/client.js";
|
3
|
+
import type { Status } from "./types/Status.js";
|
4
|
+
/**
|
5
|
+
* Retrieves a Universal Bridge quote for the provided sell intent. The quote will specify the expected `destinationAmount` that will be received in exchange for the specified `originAmount`, which is specified with the `sellAmountWei` option.
|
6
|
+
*
|
7
|
+
+ * The returned status will include both the origin and destination transactions and any finalized amounts for the route.
|
8
|
+
*
|
9
|
+
* @example
|
10
|
+
* ```typescript
|
11
|
+
* import { Bridge } from "thirdweb";
|
12
|
+
*
|
13
|
+
* const status = await Bridge.status({
|
14
|
+
* transactionHash: "0xe199ef82a0b6215221536e18ec512813c1aa10b4f5ed0d4dfdfcd703578da56d",
|
15
|
+
* chainId: 8453,
|
16
|
+
* client: thirdwebClient,
|
17
|
+
* });
|
18
|
+
* ```
|
19
|
+
*
|
20
|
+
* If the transaction is complete, a response might look like:
|
21
|
+
* ```typescript
|
22
|
+
* {
|
23
|
+
* status: 'COMPLETED',
|
24
|
+
* originAmount: 200000000000000n,
|
25
|
+
* destinationAmount: 188625148000000n,
|
26
|
+
* originChainId: 8453,
|
27
|
+
* destinationChainId: 2741,
|
28
|
+
* originTokenAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
29
|
+
* destinationTokenAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
|
30
|
+
* transactions: [
|
31
|
+
* {
|
32
|
+
* chainId: 8453,
|
33
|
+
* transactionHash: '0xe199ef82a0b6215221536e18ec512813c1aa10b4f5ed0d4dfdfcd703578da56d'
|
34
|
+
* },
|
35
|
+
* {
|
36
|
+
* chainId: 2741,
|
37
|
+
* transactionHash: '0xa70a82f42330f54be95a542e1fcfe6ed2dd9f07fb8c82ae67afb4342319f7433'
|
38
|
+
* }
|
39
|
+
* ]
|
40
|
+
* }
|
41
|
+
* ```
|
42
|
+
*
|
43
|
+
* If the origin transaction hasn't been mined yet, a response might look like:
|
44
|
+
* ```typescript
|
45
|
+
* {
|
46
|
+
* status: "NOT_FOUND",
|
47
|
+
* }
|
48
|
+
* ```
|
49
|
+
* This is to allow you to poll for the status without catching an error. Be sure your transaction hash and chain are correct though, as this could also represent a legitimate 404 if the transaction doesn't exist.
|
50
|
+
*
|
51
|
+
* If the transaction is still pending, a response might look like:
|
52
|
+
* ```typescript
|
53
|
+
* {
|
54
|
+
* status: "PENDING",
|
55
|
+
* originAmount: 1000000000000000000n,
|
56
|
+
* originChainId: 466,
|
57
|
+
* destinationChainId: 1,
|
58
|
+
* originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
59
|
+
* destinationTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
60
|
+
* transactions: [
|
61
|
+
* {
|
62
|
+
* transactionHash: "0xe199ef82a0b6215221536e18ec512813c1aa10b4f5ed0d4dfdfcd703578da56d",
|
63
|
+
* chainId: 466,
|
64
|
+
* }
|
65
|
+
* ]
|
66
|
+
* }
|
67
|
+
* ```
|
68
|
+
*
|
69
|
+
* If the transaction failed, a response might look like:
|
70
|
+
* ```typescript
|
71
|
+
* {
|
72
|
+
* status: "FAILED",
|
73
|
+
* transactions: [
|
74
|
+
* {
|
75
|
+
* transactionHash: "0xe199ef82a0b6215221536e18ec512813c1aa10b4f5ed0d4dfdfcd703578da56d",
|
76
|
+
* chainId: 466,
|
77
|
+
* }
|
78
|
+
* ]
|
79
|
+
* }
|
80
|
+
* ```
|
81
|
+
*
|
82
|
+
* This status is for a **single origin transaction only**. If your route involves multiple transactions, you'll need to get the status for each of them individually.
|
83
|
+
*
|
84
|
+
* If sending multiple dependent sequential transactions, wait until `status` returns `COMPLETED` before sending the next transaction.
|
85
|
+
*
|
86
|
+
* You can access this function's input and output types with `status.Options` and `status.Result`, respectively.
|
87
|
+
*
|
88
|
+
* @param options - The options for the quote.
|
89
|
+
* @param options.transactionHash - The hash of the origin transaction to get the bridge status for.
|
90
|
+
* @param options.chainId - The chain ID of the origin token.
|
91
|
+
* @param options.client - Your thirdweb client.
|
92
|
+
*
|
93
|
+
* @returns A promise that resolves to a status object for the transaction.
|
94
|
+
*
|
95
|
+
* @throws Will throw an error if there is an issue fetching the status.
|
96
|
+
* @bridge
|
97
|
+
* @beta
|
98
|
+
*/
|
99
|
+
export declare function status(options: status.Options): Promise<status.Result>;
|
100
|
+
export declare namespace status {
|
101
|
+
type Options = {
|
102
|
+
transactionHash: ox__Hex.Hex;
|
103
|
+
chainId: number;
|
104
|
+
client: ThirdwebClient;
|
105
|
+
};
|
106
|
+
type Result = Status;
|
107
|
+
}
|
108
|
+
//# sourceMappingURL=Status.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Status.d.ts","sourceRoot":"","sources":["../../../src/bridge/Status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,IAAI,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAmD5E;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,KAAK,OAAO,GAAG;QACb,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC;QAC7B,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,cAAc,CAAC;KACxB,CAAC;IAEF,KAAK,MAAM,GAAG,MAAM,CAAC;CACtB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/bridge/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,mCAAmC,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export * as Buy from "./Buy.js";
|
2
|
+
export * as Sell from "./Sell.js";
|
3
|
+
export { status } from "./Status.js";
|
4
|
+
export { routes } from "./Routes.js";
|
5
|
+
export type { Status } from "./types/Status.js";
|
6
|
+
export type { Route } from "./types/Route.js";
|
7
|
+
export type { Quote, PreparedQuote } from "./types/Quote.js";
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/bridge/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import type { TransactionEnvelopeEip1559 as ox__TransactionEnvelopeEip1559 } from "ox";
|
2
|
+
export type Quote = {
|
3
|
+
/**
|
4
|
+
* The input amount (in wei) including fees to be paid.
|
5
|
+
*/
|
6
|
+
originAmount: bigint;
|
7
|
+
/**
|
8
|
+
* The output amount (in wei) to be received.
|
9
|
+
*/
|
10
|
+
destinationAmount: bigint;
|
11
|
+
/**
|
12
|
+
* The blocknumber this quote was generated at.
|
13
|
+
*/
|
14
|
+
blockNumber?: bigint;
|
15
|
+
/**
|
16
|
+
* The timestamp this quote was generated at.
|
17
|
+
*/
|
18
|
+
timestamp: number;
|
19
|
+
/**
|
20
|
+
* The estimated execution time in milliseconds.
|
21
|
+
*/
|
22
|
+
estimatedExecutionTimeMs?: number | undefined;
|
23
|
+
};
|
24
|
+
export type PreparedQuote = Quote & {
|
25
|
+
/**
|
26
|
+
* The expiration timestamp for the quote. All transactions must be executed before this timestamp to guarantee successful execution at the specified price.
|
27
|
+
*/
|
28
|
+
expiration?: number | undefined;
|
29
|
+
/**
|
30
|
+
* A series of [ox](https://oxlib.sh) EIP-1559 transactions that must be executed in sequential order to fulfill the complete route.
|
31
|
+
*/
|
32
|
+
transactions: Array<ox__TransactionEnvelopeEip1559.TransactionEnvelopeEip1559<false, bigint, number, "eip1559">>;
|
33
|
+
};
|
34
|
+
//# sourceMappingURL=Quote.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Quote.d.ts","sourceRoot":"","sources":["../../../../src/bridge/types/Quote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,IAAI,8BAA8B,EAAE,MAAM,IAAI,CAAC;AAEvF,MAAM,MAAM,KAAK,GAAG;IAClB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC;;OAEG;IACH,YAAY,EAAE,KAAK,CACjB,8BAA8B,CAAC,0BAA0B,CACvD,KAAK,EACL,MAAM,EACN,MAAM,EACN,SAAS,CACV,CACF,CAAC;CACH,CAAC"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import type { Address as ox__Address } from "ox";
|
2
|
+
export type Route = {
|
3
|
+
originToken: {
|
4
|
+
chainId: number;
|
5
|
+
address: ox__Address.Address;
|
6
|
+
decimals: number;
|
7
|
+
symbol: string;
|
8
|
+
name: string;
|
9
|
+
iconUri?: string;
|
10
|
+
};
|
11
|
+
destinationToken: {
|
12
|
+
chainId: number;
|
13
|
+
address: string;
|
14
|
+
decimals: number;
|
15
|
+
symbol: string;
|
16
|
+
name: string;
|
17
|
+
iconUri?: string;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
//# sourceMappingURL=Route.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../../../../src/bridge/types/Route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjD,MAAM,MAAM,KAAK,GAAG;IAClB,WAAW,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC;QAC7B,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,gBAAgB,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC"}
|