Skip to content

Commit 8a12f32

Browse files
committed
feat: include client and chain in transactions
1 parent b2b6ff7 commit 8a12f32

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

packages/thirdweb/src/bridge/Buy.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../client/client.js";
33
import { getClientFetch } from "../utils/fetch.js";
44
import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
55
import type { PreparedQuote, Quote } from "./types/Quote.js";
6+
import { defineChain } from "../chains/utils.js";
67

78
/**
89
* 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.
@@ -240,6 +241,8 @@ export async function prepare(
240241
transactions: data.transactions.map((transaction) => ({
241242
...transaction,
242243
value: transaction.value ? BigInt(transaction.value) : undefined,
244+
client,
245+
chain: defineChain(transaction.chainId),
243246
})),
244247
expiration: data.expiration,
245248
intent: {

packages/thirdweb/src/bridge/Sell.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../client/client.js";
33
import { getClientFetch } from "../utils/fetch.js";
44
import { UNIVERSAL_BRIDGE_URL } from "./constants.js";
55
import type { PreparedQuote, Quote } from "./types/Quote.js";
6+
import { defineChain } from "../chains/utils.js";
67

78
/**
89
* 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.
@@ -241,6 +242,8 @@ export async function prepare(
241242
transactions: data.transactions.map((transaction) => ({
242243
...transaction,
243244
value: transaction.value ? BigInt(transaction.value) : undefined,
245+
client,
246+
chain: defineChain(transaction.chainId),
244247
})),
245248
expiration: data.expiration,
246249
intent: {

packages/thirdweb/src/bridge/types/Quote.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import type {
22
Hex as ox__Hex,
33
TransactionEnvelopeEip1559 as ox__TransactionEnvelopeEip1559,
44
} from "ox";
5+
import type { Chain } from "../../chains/types.js";
6+
import type { ThirdwebClient } from "../../client/client.js";
57

68
export type Quote = {
79
/**
@@ -49,6 +51,8 @@ export type PreparedQuote = Quote & {
4951
* The transaction ID, used for tracking purposes.
5052
*/
5153
id: ox__Hex.Hex;
54+
client: ThirdwebClient;
55+
chain: Chain;
5256
}
5357
>;
5458
};

0 commit comments

Comments
 (0)