thirdweb 5.101.2-nightly-91750eddc6cc3eb20c36b74490d820b92ea5500f-20250529000432 → 5.102.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/bridge/Webhook.js +3 -1
- package/dist/cjs/bridge/Webhook.js.map +1 -1
- package/dist/cjs/cli/commands/stylus/builder.js +39 -12
- package/dist/cjs/cli/commands/stylus/builder.js.map +1 -1
- package/dist/cjs/cli/commands/stylus/create.js +31 -7
- package/dist/cjs/cli/commands/stylus/create.js.map +1 -1
- package/dist/cjs/engine/create-server-wallet.js +46 -0
- package/dist/cjs/engine/create-server-wallet.js.map +1 -0
- package/dist/cjs/engine/get-status.js +0 -54
- package/dist/cjs/engine/get-status.js.map +1 -1
- package/dist/cjs/engine/index.js +9 -2
- package/dist/cjs/engine/index.js.map +1 -1
- package/dist/cjs/engine/list-server-wallets.js +40 -0
- package/dist/cjs/engine/list-server-wallets.js.map +1 -0
- package/dist/cjs/engine/search-transactions.js +115 -0
- package/dist/cjs/engine/search-transactions.js.map +1 -0
- package/dist/cjs/engine/server-wallet.js +97 -17
- package/dist/cjs/engine/server-wallet.js.map +1 -1
- package/dist/cjs/engine/wait-for-tx-hash.js +59 -0
- package/dist/cjs/engine/wait-for-tx-hash.js.map +1 -0
- package/dist/cjs/insight/get-nfts.js +6 -1
- package/dist/cjs/insight/get-nfts.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js +1 -0
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getQuote.js +1 -0
- package/dist/cjs/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js +4 -10
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js.map +1 -1
- package/dist/cjs/utils/fetch.js +1 -0
- package/dist/cjs/utils/fetch.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/bridge/Webhook.js +3 -1
- package/dist/esm/bridge/Webhook.js.map +1 -1
- package/dist/esm/cli/commands/stylus/builder.js +39 -12
- package/dist/esm/cli/commands/stylus/builder.js.map +1 -1
- package/dist/esm/cli/commands/stylus/create.js +31 -7
- package/dist/esm/cli/commands/stylus/create.js.map +1 -1
- package/dist/esm/engine/create-server-wallet.js +43 -0
- package/dist/esm/engine/create-server-wallet.js.map +1 -0
- package/dist/esm/engine/get-status.js +0 -53
- package/dist/esm/engine/get-status.js.map +1 -1
- package/dist/esm/engine/index.js +5 -1
- package/dist/esm/engine/index.js.map +1 -1
- package/dist/esm/engine/list-server-wallets.js +37 -0
- package/dist/esm/engine/list-server-wallets.js.map +1 -0
- package/dist/esm/engine/search-transactions.js +112 -0
- package/dist/esm/engine/search-transactions.js.map +1 -0
- package/dist/esm/engine/server-wallet.js +96 -16
- package/dist/esm/engine/server-wallet.js.map +1 -1
- package/dist/esm/engine/wait-for-tx-hash.js +56 -0
- package/dist/esm/engine/wait-for-tx-hash.js.map +1 -0
- package/dist/esm/insight/get-nfts.js +6 -1
- package/dist/esm/insight/get-nfts.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getTransfer.js +1 -0
- package/dist/esm/pay/buyWithCrypto/getTransfer.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getQuote.js +1 -0
- package/dist/esm/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js +4 -10
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.js.map +1 -1
- package/dist/esm/utils/fetch.js +1 -0
- package/dist/esm/utils/fetch.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/bridge/Webhook.d.ts +3 -1
- package/dist/types/bridge/Webhook.d.ts.map +1 -1
- package/dist/types/cli/commands/stylus/builder.d.ts.map +1 -1
- package/dist/types/cli/commands/stylus/create.d.ts.map +1 -1
- package/dist/types/engine/create-server-wallet.d.ts +29 -0
- package/dist/types/engine/create-server-wallet.d.ts.map +1 -0
- package/dist/types/engine/get-status.d.ts +0 -23
- package/dist/types/engine/get-status.d.ts.map +1 -1
- package/dist/types/engine/index.d.ts +5 -1
- package/dist/types/engine/index.d.ts.map +1 -1
- package/dist/types/engine/list-server-wallets.d.ts +25 -0
- package/dist/types/engine/list-server-wallets.d.ts.map +1 -0
- package/dist/types/engine/search-transactions.d.ts +127 -0
- package/dist/types/engine/search-transactions.d.ts.map +1 -0
- package/dist/types/engine/server-wallet.d.ts +36 -0
- package/dist/types/engine/server-wallet.d.ts.map +1 -1
- package/dist/types/engine/wait-for-tx-hash.d.ts +25 -0
- package/dist/types/engine/wait-for-tx-hash.d.ts.map +1 -0
- package/dist/types/pay/buyWithCrypto/getTransfer.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getQuote.d.ts +1 -0
- package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.d.ts.map +1 -1
- package/dist/types/utils/fetch.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/bridge/Chains.test.ts +1 -1
- package/src/bridge/Webhook.ts +3 -1
- package/src/cli/commands/stylus/builder.ts +45 -12
- package/src/cli/commands/stylus/create.ts +33 -8
- package/src/engine/create-server-wallet.ts +57 -0
- package/src/engine/get-status.ts +0 -69
- package/src/engine/index.ts +13 -1
- package/src/engine/list-server-wallets.ts +46 -0
- package/src/engine/search-transactions.ts +132 -0
- package/src/engine/server-wallet.test.ts +54 -0
- package/src/engine/server-wallet.ts +104 -17
- package/src/engine/wait-for-tx-hash.ts +75 -0
- package/src/extensions/erc1155/read/getOwnedNFTs.test.ts +25 -0
- package/src/extensions/erc20/drop20.test.ts +91 -1
- package/src/insight/get-nfts.ts +6 -1
- package/src/pay/buyWithCrypto/getTransfer.ts +1 -0
- package/src/pay/buyWithFiat/getQuote.ts +1 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.tsx +3 -16
- package/src/utils/fetch.ts +1 -0
- package/src/version.ts +1 -1
@@ -0,0 +1,127 @@
|
|
1
|
+
import { type TransactionsFilterNested, type TransactionsFilterValue } from "@thirdweb-dev/engine";
|
2
|
+
import type { ThirdwebClient } from "../client/client.js";
|
3
|
+
export type SearchTransactionsArgs = {
|
4
|
+
client: ThirdwebClient;
|
5
|
+
filters?: (TransactionsFilterValue | TransactionsFilterNested)[];
|
6
|
+
pageSize?: number;
|
7
|
+
page?: number;
|
8
|
+
};
|
9
|
+
/**
|
10
|
+
* Search for transactions by their ids.
|
11
|
+
* @param args - The arguments for the search.
|
12
|
+
* @param args.client - The thirdweb client to use.
|
13
|
+
* @param args.transactionIds - The ids of the transactions to search for.
|
14
|
+
* @engine
|
15
|
+
* @example
|
16
|
+
* ## Search for transactions by their ids
|
17
|
+
*
|
18
|
+
* ```ts
|
19
|
+
* import { Engine } from "thirdweb";
|
20
|
+
*
|
21
|
+
* const transactions = await Engine.searchTransactions({
|
22
|
+
* client,
|
23
|
+
* filters: [
|
24
|
+
* {
|
25
|
+
* field: "id",
|
26
|
+
* values: ["1", "2", "3"],
|
27
|
+
* },
|
28
|
+
* ],
|
29
|
+
* });
|
30
|
+
* console.log(transactions);
|
31
|
+
* ```
|
32
|
+
*
|
33
|
+
* ## Search for transactions by chain id
|
34
|
+
*
|
35
|
+
* ```ts
|
36
|
+
* import { Engine } from "thirdweb";
|
37
|
+
*
|
38
|
+
* const transactions = await Engine.searchTransactions({
|
39
|
+
* client,
|
40
|
+
* filters: [
|
41
|
+
* {
|
42
|
+
* field: "chainId",
|
43
|
+
* values: ["1", "137"],
|
44
|
+
* },
|
45
|
+
* ],
|
46
|
+
* });
|
47
|
+
* console.log(transactions);
|
48
|
+
* ```
|
49
|
+
*
|
50
|
+
* ## Search for transactions by sender wallet address
|
51
|
+
*
|
52
|
+
* ```ts
|
53
|
+
* import { Engine } from "thirdweb";
|
54
|
+
*
|
55
|
+
* const transactions = await Engine.searchTransactions({
|
56
|
+
* client,
|
57
|
+
* filters: [
|
58
|
+
* {
|
59
|
+
* field: "from",
|
60
|
+
* values: ["0x1234567890123456789012345678901234567890"],
|
61
|
+
* },
|
62
|
+
* ],
|
63
|
+
* });
|
64
|
+
* console.log(transactions);
|
65
|
+
* ```
|
66
|
+
*
|
67
|
+
* ## Combined search
|
68
|
+
*
|
69
|
+
* ```ts
|
70
|
+
* import { Engine } from "thirdweb";
|
71
|
+
*
|
72
|
+
* const transactions = await Engine.searchTransactions({
|
73
|
+
* client,
|
74
|
+
* filters: [
|
75
|
+
* {
|
76
|
+
* filters: [
|
77
|
+
* {
|
78
|
+
* field: "from",
|
79
|
+
* values: ["0x1234567890123456789012345678901234567890"],
|
80
|
+
* },
|
81
|
+
* {
|
82
|
+
* field: "chainId",
|
83
|
+
* values: ["8453"],
|
84
|
+
* },
|
85
|
+
* ],
|
86
|
+
* operation: "AND",
|
87
|
+
* },
|
88
|
+
* ],
|
89
|
+
* pageSize: 100,
|
90
|
+
* page: 0,
|
91
|
+
* });
|
92
|
+
* console.log(transactions);
|
93
|
+
* ```
|
94
|
+
*/
|
95
|
+
export declare function searchTransactions(args: SearchTransactionsArgs): Promise<{
|
96
|
+
transactions: Array<{
|
97
|
+
id: string;
|
98
|
+
batchIndex: number;
|
99
|
+
clientId: string;
|
100
|
+
chainId: string;
|
101
|
+
from: string | null;
|
102
|
+
transactionParams: (string | number | boolean | null) | {
|
103
|
+
[key: string]: unknown;
|
104
|
+
} | Array<unknown>;
|
105
|
+
transactionHash: string | null;
|
106
|
+
confirmedAt: string | null;
|
107
|
+
confirmedAtBlockNumber: string | null;
|
108
|
+
enrichedData: (string | number | boolean | null) | {
|
109
|
+
[key: string]: unknown;
|
110
|
+
} | Array<unknown>;
|
111
|
+
executionParams: (string | number | boolean | null) | {
|
112
|
+
[key: string]: unknown;
|
113
|
+
} | Array<unknown>;
|
114
|
+
executionResult: (string | number | boolean | null) | {
|
115
|
+
[key: string]: unknown;
|
116
|
+
} | Array<unknown> | null;
|
117
|
+
createdAt: string;
|
118
|
+
errorMessage: string | null;
|
119
|
+
cancelledAt: string | null;
|
120
|
+
}>;
|
121
|
+
pagination: {
|
122
|
+
totalCount: number;
|
123
|
+
page: number;
|
124
|
+
limit: number;
|
125
|
+
};
|
126
|
+
}>;
|
127
|
+
//# sourceMappingURL=search-transactions.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"search-transactions.d.ts","sourceRoot":"","sources":["../../../src/engine/search-transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAE7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAK1D,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,uBAAuB,GAAG,wBAAwB,CAAC,EAAE,CAAC;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BpE"}
|
@@ -35,6 +35,11 @@ export type ServerWallet = Account & {
|
|
35
35
|
}) => Promise<{
|
36
36
|
transactionId: string;
|
37
37
|
}>;
|
38
|
+
enqueueBatchTransaction: (args: {
|
39
|
+
transactions: PreparedTransaction[];
|
40
|
+
}) => Promise<{
|
41
|
+
transactionId: string;
|
42
|
+
}>;
|
38
43
|
};
|
39
44
|
/**
|
40
45
|
* Create a server wallet for sending transactions and signing messages via engine (v3+).
|
@@ -82,6 +87,37 @@ export type ServerWallet = Account & {
|
|
82
87
|
* console.log("Transaction sent:", transactionHash);
|
83
88
|
* ```
|
84
89
|
*
|
90
|
+
* ### Sending a batch of transactions
|
91
|
+
* ```ts
|
92
|
+
* // prepare the transactions
|
93
|
+
* const transaction1 = claimTo({
|
94
|
+
* contract,
|
95
|
+
* to: firstRecipient,
|
96
|
+
* quantity: 1n,
|
97
|
+
* });
|
98
|
+
* const transaction2 = claimTo({
|
99
|
+
* contract,
|
100
|
+
* to: secondRecipient,
|
101
|
+
* quantity: 1n,
|
102
|
+
* });
|
103
|
+
*
|
104
|
+
*
|
105
|
+
* // enqueue the transactions in a batch
|
106
|
+
* const { transactionId } = await myServerWallet.enqueueBatchTransaction({
|
107
|
+
* transactions: [transaction1, transaction2],
|
108
|
+
* });
|
109
|
+
* ```
|
110
|
+
*
|
111
|
+
* ### Polling for the batch of transactions to be submitted onchain
|
112
|
+
* ```ts
|
113
|
+
* // optionally poll for the transaction to be submitted onchain
|
114
|
+
* const { transactionHash } = await Engine.waitForTransactionHash({
|
115
|
+
* client,
|
116
|
+
* transactionId,
|
117
|
+
* });
|
118
|
+
* console.log("Transaction sent:", transactionHash);
|
119
|
+
* ```
|
120
|
+
*
|
85
121
|
* ### Getting the execution status of a transaction
|
86
122
|
* ```ts
|
87
123
|
* const executionResult = await Engine.getTransactionStatus({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"server-wallet.d.ts","sourceRoot":"","sources":["../../../src/engine/server-wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAI9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc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B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;OAEG;IACH,gBAAgB,CAAC,EACb,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GACnC,IAAI,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG;IACnC,kBAAkB,EAAE,CAAC,IAAI,EAAE;QACzB,WAAW,EAAE,mBAAmB,CAAC;QACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,KAAK,OAAO,CAAC;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzC,uBAAuB,EAAE,CAAC,IAAI,EAAE;QAC9B,YAAY,EAAE,mBAAmB,EAAE,CAAC;KACrC,KAAK,OAAO,CAAC;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAkOvE"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import type { ThirdwebClient } from "../client/client.js";
|
2
|
+
import type { WaitForReceiptOptions } from "../transaction/actions/wait-for-tx-receipt.js";
|
3
|
+
/**
|
4
|
+
* Wait for a transaction to be submitted onchain and return the transaction hash.
|
5
|
+
* @param args - The arguments for the transaction.
|
6
|
+
* @param args.client - The thirdweb client to use.
|
7
|
+
* @param args.transactionId - The id of the transaction to wait for.
|
8
|
+
* @param args.timeoutInSeconds - The timeout in seconds.
|
9
|
+
* @engine
|
10
|
+
* @example
|
11
|
+
* ```ts
|
12
|
+
* import { Engine } from "thirdweb";
|
13
|
+
*
|
14
|
+
* const { transactionHash } = await Engine.waitForTransactionHash({
|
15
|
+
* client,
|
16
|
+
* transactionId, // the transaction id returned from enqueueTransaction
|
17
|
+
* });
|
18
|
+
* ```
|
19
|
+
*/
|
20
|
+
export declare function waitForTransactionHash(args: {
|
21
|
+
client: ThirdwebClient;
|
22
|
+
transactionId: string;
|
23
|
+
timeoutInSeconds?: number;
|
24
|
+
}): Promise<WaitForReceiptOptions>;
|
25
|
+
//# sourceMappingURL=wait-for-tx-hash.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wait-for-tx-hash.d.ts","sourceRoot":"","sources":["../../../src/engine/wait-for-tx-hash.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAG3F;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,MAAM,EAAE,cAAc,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA6CjC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getTransfer.d.ts","sourceRoot":"","sources":["../../../../src/pay/buyWithCrypto/getTransfer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE7E;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C;;;;;;OAMG;IACH,MAAM,EAAE,cAAc,CAAC;IAEvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;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B,CAAC;IACF;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,cAAc,EAAE;QACd,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;QACvB,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC;KAChC,EAAE,CAAC;IACJ;;;;;OAKG;IACH,WAAW,EAAE;QACX,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,YAAY,CAAC;KACrB,CAAC;IAEF;;OAEG;IACH,YAAY,CAAC,EAAE;QACb,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,YAAY,CAAC;KACrB,CAAC;IAEF;;;;;;;;;OASG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,gBAAgB,CAAC,CA8L3B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SwapScreenContent.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAK5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mDAAmD,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAIlG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;
|
1
|
+
{"version":3,"file":"SwapScreenContent.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapScreenContent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAK5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mDAAmD,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+DAA+D,CAAC;AAIlG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAYtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,KAAK,kBAAkB,EAAiB,MAAM,sBAAsB,CAAC;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,SAAS,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,EAAE,KAAK,CAAC;IACf,SAAS,EAAE,KAAK,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC1C,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,YAAY,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,cAAc,EAAE,sBAAsB,GAAG,SAAS,CAAC;IACnD,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,kBAAkB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,qBAAqB,EAAE,OAAO,CAAC;IAC/B,aAAa,EAAE,SAAS,GAAG,MAAM,CAAC;CACnC,2CA8SA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/utils/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAY1C;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,SAAS,SAKnE,MAAM,GAAG,OAAO,SACd,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,GAAG;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,KACA,OAAO,CAAC,QAAQ,CAAC,CA4FrB;
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/utils/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAY1C;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,SAAS,SAKnE,MAAM,GAAG,OAAO,SACd,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,GAAG;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,KACA,OAAO,CAAC,QAAQ,CAAC,CA4FrB;AAYD,eAAO,MAAM,qBAAqB,iBAA4B,CAAC;AAE/D;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAyBlD;AAwCD;;GAEG;AACH,wBAAgB,kBAAkB,uBA0BjC"}
|
package/dist/types/version.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare const version = "5.
|
1
|
+
export declare const version = "5.102.0";
|
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,YAAY,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "thirdweb",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.102.0",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "git+https://github.com/thirdweb-dev/js.git#main"
|
@@ -251,8 +251,8 @@
|
|
251
251
|
"uqr": "0.1.2",
|
252
252
|
"viem": "2.28.1",
|
253
253
|
"zod": "3.25.24",
|
254
|
-
"@thirdweb-dev/engine": "3.0.
|
255
|
-
"@thirdweb-dev/insight": "1.0.1
|
254
|
+
"@thirdweb-dev/engine": "3.0.3",
|
255
|
+
"@thirdweb-dev/insight": "1.0.1"
|
256
256
|
},
|
257
257
|
"peerDependencies": {
|
258
258
|
"@aws-sdk/client-lambda": "^3",
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
|
2
2
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
3
3
|
import { chains } from "./Chains.js";
|
4
4
|
|
5
|
-
describe("chains", () => {
|
5
|
+
describe.runIf(process.env.TW_SECRET_KEY)("chains", () => {
|
6
6
|
it("should fetch chains", async () => {
|
7
7
|
// Setup
|
8
8
|
const client = TEST_CLIENT;
|
package/src/bridge/Webhook.ts
CHANGED
@@ -60,11 +60,13 @@ export type WebhookPayload = Exclude<
|
|
60
60
|
>;
|
61
61
|
|
62
62
|
/**
|
63
|
-
* Parses an incoming webhook
|
63
|
+
* Parses an incoming Universal Bridge webhook payload.
|
64
64
|
*
|
65
65
|
* @param payload - The raw text body received from thirdweb.
|
66
66
|
* @param headers - The webhook headers received from thirdweb.
|
67
67
|
* @param secret - The webhook secret to verify the payload with.
|
68
|
+
* @beta
|
69
|
+
* @bridge Webhook
|
68
70
|
*/
|
69
71
|
export async function parse(
|
70
72
|
/**
|
@@ -3,6 +3,7 @@ import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
4
4
|
import open from "open";
|
5
5
|
import ora, { type Ora } from "ora";
|
6
|
+
import prompts from "prompts";
|
6
7
|
import { parse } from "toml";
|
7
8
|
import { createThirdwebClient } from "../../../client/client.js";
|
8
9
|
import { upload } from "../../../storage/upload.js";
|
@@ -95,15 +96,49 @@ async function buildStylus(spinner: Ora, secretKey?: string) {
|
|
95
96
|
spinner.succeed("ABI generated.");
|
96
97
|
|
97
98
|
// Step 4: Process the output
|
98
|
-
const
|
99
|
-
|
99
|
+
const parts = abiContent.split(/======= <stdin>:/g).filter(Boolean);
|
100
|
+
const contractNames = extractContractNamesFromExportAbi(abiContent);
|
101
|
+
|
102
|
+
let selectedContractName: string | undefined;
|
103
|
+
let selectedAbiContent: string | undefined;
|
104
|
+
|
105
|
+
if (contractNames.length === 1) {
|
106
|
+
selectedContractName = contractNames[0]?.replace(/^I/, "");
|
107
|
+
selectedAbiContent = parts[0];
|
108
|
+
} else {
|
109
|
+
const response = await prompts({
|
110
|
+
type: "select",
|
111
|
+
name: "contract",
|
112
|
+
message: "Select entrypoint:",
|
113
|
+
choices: contractNames.map((name, idx) => ({
|
114
|
+
title: name,
|
115
|
+
value: idx,
|
116
|
+
})),
|
117
|
+
});
|
118
|
+
|
119
|
+
const selectedIndex = response.contract;
|
120
|
+
|
121
|
+
if (typeof selectedIndex !== "number") {
|
122
|
+
spinner.fail("No contract selected.");
|
123
|
+
process.exit(1);
|
124
|
+
}
|
125
|
+
|
126
|
+
selectedContractName = contractNames[selectedIndex]?.replace(/^I/, "");
|
127
|
+
selectedAbiContent = parts[selectedIndex];
|
128
|
+
}
|
129
|
+
|
130
|
+
if (!selectedAbiContent) {
|
131
|
+
throw new Error("Entrypoint not found");
|
132
|
+
}
|
133
|
+
|
134
|
+
if (!selectedContractName) {
|
100
135
|
spinner.fail("Error: Could not determine contract name from ABI output.");
|
101
136
|
process.exit(1);
|
102
137
|
}
|
103
138
|
|
104
139
|
let cleanedAbi = "";
|
105
140
|
try {
|
106
|
-
const jsonMatch =
|
141
|
+
const jsonMatch = selectedAbiContent.match(/\[.*\]/s);
|
107
142
|
if (jsonMatch) {
|
108
143
|
cleanedAbi = jsonMatch[0];
|
109
144
|
} else {
|
@@ -125,7 +160,7 @@ async function buildStylus(spinner: Ora, secretKey?: string) {
|
|
125
160
|
},
|
126
161
|
settings: {
|
127
162
|
compilationTarget: {
|
128
|
-
"src/main.rs":
|
163
|
+
"src/main.rs": selectedContractName,
|
129
164
|
},
|
130
165
|
},
|
131
166
|
sources: {},
|
@@ -152,12 +187,12 @@ async function buildStylus(spinner: Ora, secretKey?: string) {
|
|
152
187
|
client,
|
153
188
|
files: [
|
154
189
|
{
|
155
|
-
name:
|
190
|
+
name: selectedContractName,
|
156
191
|
metadataUri,
|
157
192
|
bytecodeUri,
|
158
193
|
analytics: {
|
159
194
|
command: "publish-stylus",
|
160
|
-
contract_name:
|
195
|
+
contract_name: selectedContractName,
|
161
196
|
cli_version: "",
|
162
197
|
project_type: "stylus",
|
163
198
|
},
|
@@ -178,12 +213,10 @@ async function buildStylus(spinner: Ora, secretKey?: string) {
|
|
178
213
|
}
|
179
214
|
}
|
180
215
|
|
181
|
-
function
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
}
|
186
|
-
return null;
|
216
|
+
function extractContractNamesFromExportAbi(abiRawOutput: string): string[] {
|
217
|
+
return [...abiRawOutput.matchAll(/<stdin>:(I?[A-Za-z0-9_]+)/g)]
|
218
|
+
.map((m) => m[1])
|
219
|
+
.filter((name): name is string => typeof name === "string");
|
187
220
|
}
|
188
221
|
|
189
222
|
function getUrl(hash: string, command: string) {
|
@@ -37,15 +37,40 @@ export async function createStylusProject() {
|
|
37
37
|
message: "Project name:",
|
38
38
|
initial: "my-stylus-project",
|
39
39
|
});
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
|
41
|
+
// Step 4: Select project type
|
42
|
+
const { projectType } = await prompts({
|
43
|
+
type: "select",
|
44
|
+
name: "projectType",
|
45
|
+
message: "Select a template:",
|
46
|
+
choices: [
|
47
|
+
{ title: "Default", value: "default" },
|
48
|
+
{ title: "ERC20", value: "erc20" },
|
49
|
+
],
|
43
50
|
});
|
44
|
-
|
45
|
-
|
46
|
-
|
51
|
+
|
52
|
+
// Step 5: Create the project
|
53
|
+
if (projectType === "default") {
|
54
|
+
spinner.start(`Creating new Stylus project: ${projectName}...`);
|
55
|
+
const newProject = spawnSync("cargo", ["stylus", "new", projectName], {
|
56
|
+
stdio: "inherit",
|
57
|
+
});
|
58
|
+
if (newProject.status !== 0) {
|
59
|
+
spinner.fail("Failed to create Stylus project.");
|
60
|
+
process.exit(1);
|
61
|
+
}
|
62
|
+
} else if (projectType === "erc20") {
|
63
|
+
const repoUrl = "git@github.com:thirdweb-example/stylus-erc20-template.git";
|
64
|
+
spinner.start(`Creating new ERC20 Stylus project: ${projectName}...`);
|
65
|
+
const clone = spawnSync("git", ["clone", repoUrl, projectName], {
|
66
|
+
stdio: "inherit",
|
67
|
+
});
|
68
|
+
if (clone.status !== 0) {
|
69
|
+
spinner.fail("Failed to create Stylus project.");
|
70
|
+
process.exit(1);
|
71
|
+
}
|
47
72
|
}
|
48
|
-
spinner.succeed("Project created successfully.");
|
49
73
|
|
50
|
-
|
74
|
+
spinner.succeed("Project created successfully.");
|
75
|
+
console.log(`\n✅ cd into your project: ${projectName}`);
|
51
76
|
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import { createAccount } from "@thirdweb-dev/engine";
|
2
|
+
import { stringify } from "viem";
|
3
|
+
import type { ThirdwebClient } from "../client/client.js";
|
4
|
+
import { getThirdwebBaseUrl } from "../utils/domains.js";
|
5
|
+
import { getClientFetch } from "../utils/fetch.js";
|
6
|
+
|
7
|
+
export type CreateServerWalletArgs = {
|
8
|
+
client: ThirdwebClient;
|
9
|
+
label: string;
|
10
|
+
};
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Create a server wallet.
|
14
|
+
* @param params - The parameters for the server wallet.
|
15
|
+
* @param params.client - The thirdweb client to use.
|
16
|
+
* @param params.label - The label for the server wallet.
|
17
|
+
* @returns The server wallet signer address and the predicted smart account address.
|
18
|
+
* @engine
|
19
|
+
* @example
|
20
|
+
* ```ts
|
21
|
+
* import { Engine } from "thirdweb";
|
22
|
+
*
|
23
|
+
* const serverWallet = await Engine.createServerWallet({
|
24
|
+
* client,
|
25
|
+
* label: "My Server Wallet",
|
26
|
+
* });
|
27
|
+
* console.log(serverWallet.address);
|
28
|
+
* console.log(serverWallet.smartAccountAddress);
|
29
|
+
* ```
|
30
|
+
*/
|
31
|
+
export async function createServerWallet(params: CreateServerWalletArgs) {
|
32
|
+
const { client, label } = params;
|
33
|
+
const result = await createAccount({
|
34
|
+
baseUrl: getThirdwebBaseUrl("engineCloud"),
|
35
|
+
bodySerializer: stringify,
|
36
|
+
fetch: getClientFetch(client),
|
37
|
+
body: {
|
38
|
+
label,
|
39
|
+
},
|
40
|
+
});
|
41
|
+
|
42
|
+
if (result.error) {
|
43
|
+
throw new Error(
|
44
|
+
`Error creating server wallet with label ${label}: ${stringify(
|
45
|
+
result.error,
|
46
|
+
)}`,
|
47
|
+
);
|
48
|
+
}
|
49
|
+
|
50
|
+
const data = result.data?.result;
|
51
|
+
|
52
|
+
if (!data) {
|
53
|
+
throw new Error(`No server wallet created with label ${label}`);
|
54
|
+
}
|
55
|
+
|
56
|
+
return data;
|
57
|
+
}
|
package/src/engine/get-status.ts
CHANGED
@@ -2,7 +2,6 @@ import { searchTransactions } from "@thirdweb-dev/engine";
|
|
2
2
|
import type { Chain } from "../chains/types.js";
|
3
3
|
import { getCachedChain } from "../chains/utils.js";
|
4
4
|
import type { ThirdwebClient } from "../client/client.js";
|
5
|
-
import type { WaitForReceiptOptions } from "../transaction/actions/wait-for-tx-receipt.js";
|
6
5
|
import { getThirdwebBaseUrl } from "../utils/domains.js";
|
7
6
|
import type { Hex } from "../utils/encoding/hex.js";
|
8
7
|
import { getClientFetch } from "../utils/fetch.js";
|
@@ -117,71 +116,3 @@ export async function getTransactionStatus(args: {
|
|
117
116
|
id: data.id,
|
118
117
|
};
|
119
118
|
}
|
120
|
-
|
121
|
-
/**
|
122
|
-
* Wait for a transaction to be submitted onchain and return the transaction hash.
|
123
|
-
* @param args - The arguments for the transaction.
|
124
|
-
* @param args.client - The thirdweb client to use.
|
125
|
-
* @param args.transactionId - The id of the transaction to wait for.
|
126
|
-
* @param args.timeoutInSeconds - The timeout in seconds.
|
127
|
-
* @engine
|
128
|
-
* @example
|
129
|
-
* ```ts
|
130
|
-
* import { Engine } from "thirdweb";
|
131
|
-
*
|
132
|
-
* const { transactionHash } = await Engine.waitForTransactionHash({
|
133
|
-
* client,
|
134
|
-
* transactionId, // the transaction id returned from enqueueTransaction
|
135
|
-
* });
|
136
|
-
* ```
|
137
|
-
*/
|
138
|
-
export async function waitForTransactionHash(args: {
|
139
|
-
client: ThirdwebClient;
|
140
|
-
transactionId: string;
|
141
|
-
timeoutInSeconds?: number;
|
142
|
-
}): Promise<WaitForReceiptOptions> {
|
143
|
-
const startTime = Date.now();
|
144
|
-
const TIMEOUT_IN_MS = args.timeoutInSeconds
|
145
|
-
? args.timeoutInSeconds * 1000
|
146
|
-
: 5 * 60 * 1000; // 5 minutes in milliseconds
|
147
|
-
|
148
|
-
while (Date.now() - startTime < TIMEOUT_IN_MS) {
|
149
|
-
const executionResult = await getTransactionStatus(args);
|
150
|
-
const status = executionResult.status;
|
151
|
-
|
152
|
-
switch (status) {
|
153
|
-
case "FAILED": {
|
154
|
-
throw new Error(
|
155
|
-
`Transaction failed: ${executionResult.error || "Unknown error"}`,
|
156
|
-
);
|
157
|
-
}
|
158
|
-
case "CONFIRMED": {
|
159
|
-
const onchainStatus =
|
160
|
-
executionResult && "onchainStatus" in executionResult
|
161
|
-
? executionResult.onchainStatus
|
162
|
-
: null;
|
163
|
-
if (onchainStatus === "REVERTED") {
|
164
|
-
const revertData =
|
165
|
-
"revertData" in executionResult
|
166
|
-
? executionResult.revertData
|
167
|
-
: undefined;
|
168
|
-
throw new Error(
|
169
|
-
`Transaction reverted: ${revertData?.errorName || ""} ${revertData?.errorArgs ? stringify(revertData.errorArgs) : ""}`,
|
170
|
-
);
|
171
|
-
}
|
172
|
-
return {
|
173
|
-
transactionHash: executionResult.transactionHash as Hex,
|
174
|
-
client: args.client,
|
175
|
-
chain: executionResult.chain,
|
176
|
-
};
|
177
|
-
}
|
178
|
-
default: {
|
179
|
-
// wait for the transaction to be confirmed
|
180
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
181
|
-
}
|
182
|
-
}
|
183
|
-
}
|
184
|
-
throw new Error(
|
185
|
-
`Transaction timed out after ${TIMEOUT_IN_MS / 1000} seconds`,
|
186
|
-
);
|
187
|
-
}
|
package/src/engine/index.ts
CHANGED
@@ -5,7 +5,19 @@ export {
|
|
5
5
|
} from "./server-wallet.js";
|
6
6
|
export {
|
7
7
|
getTransactionStatus,
|
8
|
-
waitForTransactionHash,
|
9
8
|
type ExecutionResult,
|
10
9
|
type RevertData,
|
11
10
|
} from "./get-status.js";
|
11
|
+
export { waitForTransactionHash } from "./wait-for-tx-hash.js";
|
12
|
+
export {
|
13
|
+
searchTransactions,
|
14
|
+
type SearchTransactionsArgs,
|
15
|
+
} from "./search-transactions.js";
|
16
|
+
export {
|
17
|
+
createServerWallet,
|
18
|
+
type CreateServerWalletArgs,
|
19
|
+
} from "./create-server-wallet.js";
|
20
|
+
export {
|
21
|
+
getServerWallets,
|
22
|
+
type GetServerWalletsArgs,
|
23
|
+
} from "./list-server-wallets.js";
|