Skip to content

Commit 9fde346

Browse files
committed
changeset
1 parent 33356e3 commit 9fde346

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

.changeset/fluffy-pigs-drive.md

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
"thirdweb": minor
3+
---
4+
5+
Enhanced SDK Bridge functionality with the following key updates:
6+
7+
1. **Breaking Change:** Standardized parameter naming in bridge functions:
8+
- Changed `buyAmountWei` to `amount` in Buy functions
9+
- Changed `sellAmountWei` to `amount` in Sell functions
10+
11+
Example:
12+
```ts
13+
// Before
14+
const buyQuote = await buy.quote({
15+
originChainId: 1,
16+
originTokenAddress: NATIVE_TOKEN_ADDRESS,
17+
destinationChainId: 10,
18+
destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
19+
buyAmountWei: toWei("0.01"),
20+
client: thirdwebClient,
21+
});
22+
23+
// After
24+
const buyQuote = await buy.quote({
25+
originChainId: 1,
26+
originTokenAddress: NATIVE_TOKEN_ADDRESS,
27+
destinationChainId: 10,
28+
destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
29+
amount: toWei("0.01"),
30+
client: thirdwebClient,
31+
});
32+
```
33+
34+
2. **Enhanced Quote Structure:** Added `steps` array to buy/sell quote responses with detailed token information:
35+
```ts
36+
// Steps contains detailed information about each step in a cross-chain transaction
37+
steps: [
38+
{
39+
originToken: {
40+
chainId: 1,
41+
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
42+
symbol: "ETH",
43+
name: "Ethereum",
44+
decimals: 18,
45+
priceUsd: 2000,
46+
iconUri: "https://..."
47+
},
48+
destinationToken: {
49+
chainId: 10,
50+
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
51+
symbol: "ETH",
52+
name: "Ethereum",
53+
decimals: 18,
54+
priceUsd: 2000,
55+
iconUri: "https://..."
56+
},
57+
originAmount: 1000000000000000000n,
58+
destinationAmount: 9980000000000000000n,
59+
estimatedExecutionTimeMs: 1000,
60+
transactions: [/* transactions for this step */]
61+
}
62+
]
63+
```
64+
65+
3. **Added Purchase Data Support:** Added optional `purchaseData` parameter to Buy and Sell functions:
66+
```ts
67+
// Example with purchaseData
68+
const quote = await buy.prepare({
69+
originChainId: 1,
70+
originTokenAddress: NATIVE_TOKEN_ADDRESS,
71+
destinationChainId: 10,
72+
destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
73+
amount: toWei("0.01"),
74+
sender: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
75+
receiver: "0x2a4f24F935Eb178e3e7BA9B53A5Ee6d8407C0709",
76+
purchaseData: {
77+
foo: "bar",
78+
},
79+
client: thirdwebClient,
80+
});
81+
```
82+
83+
4. **Enhanced Status Responses:** Status responses now include the `purchaseData` field that was provided during the initial transaction:
84+
```ts
85+
// Status response includes purchaseData
86+
{
87+
status: "COMPLETED",
88+
// ...other status fields
89+
purchaseData: {
90+
foo: "bar"
91+
}
92+
}
93+
```
94+
95+
5. **Updated API Interactions:** Changed from query parameters to JSON body for prepare functions to accommodate complex data.

0 commit comments

Comments
 (0)