viem 2.51.2 → 2.52.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/CHANGELOG.md +18 -0
- package/_cjs/errors/version.js +1 -1
- package/_cjs/tempo/Abis.js +189 -1
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Account.js +27 -20
- package/_cjs/tempo/Account.js.map +1 -1
- package/_cjs/tempo/Addresses.js +3 -1
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Decorator.js +23 -0
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/Hardfork.js +3 -0
- package/_cjs/tempo/Hardfork.js.map +1 -1
- package/_cjs/tempo/actions/accessKey.js +239 -72
- package/_cjs/tempo/actions/accessKey.js.map +1 -1
- package/_cjs/tempo/actions/index.js +2 -1
- package/_cjs/tempo/actions/index.js.map +1 -1
- package/_cjs/tempo/actions/receivePolicy.js +363 -0
- package/_cjs/tempo/actions/receivePolicy.js.map +1 -0
- package/_cjs/tempo/index.js +2 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/tempo/Abis.js +188 -0
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Account.js +35 -20
- package/_esm/tempo/Account.js.map +1 -1
- package/_esm/tempo/Addresses.js +2 -0
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Decorator.js +23 -0
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/Hardfork.js +3 -0
- package/_esm/tempo/Hardfork.js.map +1 -1
- package/_esm/tempo/actions/accessKey.js +562 -127
- package/_esm/tempo/actions/accessKey.js.map +1 -1
- package/_esm/tempo/actions/index.js +1 -0
- package/_esm/tempo/actions/index.js.map +1 -1
- package/_esm/tempo/actions/receivePolicy.js +753 -0
- package/_esm/tempo/actions/receivePolicy.js.map +1 -0
- package/_esm/tempo/index.js +1 -1
- package/_esm/tempo/index.js.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/tempo/Abis.d.ts +671 -4
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Account.d.ts +13 -2
- package/_types/tempo/Account.d.ts.map +1 -1
- package/_types/tempo/Addresses.d.ts +2 -0
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +501 -0
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/Hardfork.d.ts +1 -1
- package/_types/tempo/Hardfork.d.ts.map +1 -1
- package/_types/tempo/actions/accessKey.d.ts +1520 -304
- package/_types/tempo/actions/accessKey.d.ts.map +1 -1
- package/_types/tempo/actions/dex.d.ts +75 -0
- package/_types/tempo/actions/dex.d.ts.map +1 -1
- package/_types/tempo/actions/index.d.ts +1 -0
- package/_types/tempo/actions/index.d.ts.map +1 -1
- package/_types/tempo/actions/policy.d.ts +352 -0
- package/_types/tempo/actions/policy.d.ts.map +1 -1
- package/_types/tempo/actions/receivePolicy.d.ts +1511 -0
- package/_types/tempo/actions/receivePolicy.d.ts.map +1 -0
- package/_types/tempo/index.d.ts +1 -1
- package/_types/tempo/index.d.ts.map +1 -1
- package/errors/version.ts +1 -1
- package/package.json +2 -2
- package/tempo/Abis.ts +189 -0
- package/tempo/Account.ts +56 -27
- package/tempo/Addresses.ts +2 -0
- package/tempo/Decorator.ts +578 -0
- package/tempo/Hardfork.ts +3 -0
- package/tempo/actions/accessKey.ts +1003 -279
- package/tempo/actions/index.ts +1 -0
- package/tempo/actions/receivePolicy.ts +1266 -0
- package/tempo/index.ts +1 -0
|
@@ -0,0 +1,1511 @@
|
|
|
1
|
+
import type { Address } from 'abitype';
|
|
2
|
+
import type { ReceivePolicyReceipt } from 'ox/tempo';
|
|
3
|
+
import type { Account } from '../../accounts/types.js';
|
|
4
|
+
import type { ReadContractReturnType } from '../../actions/public/readContract.js';
|
|
5
|
+
import type { WatchContractEventParameters } from '../../actions/public/watchContractEvent.js';
|
|
6
|
+
import type { WriteContractReturnType } from '../../actions/wallet/writeContract.js';
|
|
7
|
+
import { writeContract } from '../../actions/wallet/writeContract.js';
|
|
8
|
+
import { writeContractSync } from '../../actions/wallet/writeContractSync.js';
|
|
9
|
+
import type { Client } from '../../clients/createClient.js';
|
|
10
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
|
11
|
+
import type { BaseErrorType } from '../../errors/base.js';
|
|
12
|
+
import type { Chain } from '../../types/chain.js';
|
|
13
|
+
import type { ExtractAbiItem, GetEventArgs } from '../../types/contract.js';
|
|
14
|
+
import type { Log, Log as viem_Log } from '../../types/log.js';
|
|
15
|
+
import type { Hex } from '../../types/misc.js';
|
|
16
|
+
import type { Compute, UnionOmit } from '../../types/utils.js';
|
|
17
|
+
import * as Abis from '../Abis.js';
|
|
18
|
+
import type { GetAccountParameter, ReadParameters, WriteParameters } from '../internal/types.js';
|
|
19
|
+
import type { TransactionReceipt } from '../Transaction.js';
|
|
20
|
+
/** TIP-403 policy type. */
|
|
21
|
+
export type PolicyType = 'whitelist' | 'blacklist';
|
|
22
|
+
/**
|
|
23
|
+
* Reference to a TIP-403 policy.
|
|
24
|
+
*
|
|
25
|
+
* - `'reject-all'` – built-in policy that rejects everything (id `0`).
|
|
26
|
+
* - `'allow-all'` – built-in policy that allows everything (id `1`).
|
|
27
|
+
* - `bigint` – a custom policy id (`>= 2`), e.g. one returned by
|
|
28
|
+
* {@link policy.create}.
|
|
29
|
+
*/
|
|
30
|
+
export type PolicyRef = 'reject-all' | 'allow-all' | bigint;
|
|
31
|
+
/** Reason an inbound transfer or mint was blocked by a receive policy. */
|
|
32
|
+
export type BlockedReason = ReceivePolicyReceipt.BlockedReason;
|
|
33
|
+
/**
|
|
34
|
+
* Claimer authorized to reclaim blocked funds.
|
|
35
|
+
*
|
|
36
|
+
* - `'sender'` – the originator of the funds may reclaim them (default).
|
|
37
|
+
* - `'self'` – the account configuring the policy may reclaim them.
|
|
38
|
+
* - `Address` – a delegated third party may reclaim them.
|
|
39
|
+
*/
|
|
40
|
+
export type Claimer = 'sender' | 'self' | Address;
|
|
41
|
+
/**
|
|
42
|
+
* Burns the funds backing a blocked receipt.
|
|
43
|
+
*
|
|
44
|
+
* Requires the caller to hold the token's `BURN_BLOCKED_ROLE`, and is only
|
|
45
|
+
* valid when the receipt's policy subject is currently unauthorized as a sender
|
|
46
|
+
* under the token's TIP-403 policy.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { createClient, http } from 'viem'
|
|
51
|
+
* import { tempo } from 'viem/chains'
|
|
52
|
+
* import { Actions } from 'viem/tempo'
|
|
53
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
54
|
+
*
|
|
55
|
+
* const client = createClient({
|
|
56
|
+
* account: privateKeyToAccount('0x...'),
|
|
57
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
58
|
+
* transport: http(),
|
|
59
|
+
* })
|
|
60
|
+
*
|
|
61
|
+
* const hash = await Actions.receivePolicy.burn(client, {
|
|
62
|
+
* receipt: '0x...',
|
|
63
|
+
* })
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @param client - Client.
|
|
67
|
+
* @param parameters - Parameters.
|
|
68
|
+
* @returns The transaction hash.
|
|
69
|
+
*/
|
|
70
|
+
export declare function burn<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: burn.Parameters<chain, account>): Promise<burn.ReturnValue>;
|
|
71
|
+
export declare namespace burn {
|
|
72
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
|
|
73
|
+
type Args = {
|
|
74
|
+
/** The encoded claim receipt (witness from a `TransferBlocked` event). */
|
|
75
|
+
receipt: Hex;
|
|
76
|
+
};
|
|
77
|
+
type ReturnValue = WriteContractReturnType;
|
|
78
|
+
type ErrorType = BaseErrorType;
|
|
79
|
+
/** @internal */
|
|
80
|
+
function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: Parameters<chain, account>): Promise<ReturnType<action>>;
|
|
81
|
+
/**
|
|
82
|
+
* Defines a call to the `burnBlockedReceipt` function.
|
|
83
|
+
*
|
|
84
|
+
* @param args - Arguments.
|
|
85
|
+
* @returns The call.
|
|
86
|
+
*/
|
|
87
|
+
function call(args: Args): {
|
|
88
|
+
abi: [{
|
|
89
|
+
readonly name: "burnBlockedReceipt";
|
|
90
|
+
readonly type: "function";
|
|
91
|
+
readonly stateMutability: "nonpayable";
|
|
92
|
+
readonly inputs: readonly [{
|
|
93
|
+
readonly type: "bytes";
|
|
94
|
+
readonly name: "receipt";
|
|
95
|
+
}];
|
|
96
|
+
readonly outputs: readonly [];
|
|
97
|
+
}];
|
|
98
|
+
functionName: "burnBlockedReceipt";
|
|
99
|
+
} & {
|
|
100
|
+
args: readonly [`0x${string}`];
|
|
101
|
+
} & {
|
|
102
|
+
address: Address;
|
|
103
|
+
} & {
|
|
104
|
+
data: Hex;
|
|
105
|
+
to: Address;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Extracts the `ReceiptBurned` event from logs.
|
|
109
|
+
*
|
|
110
|
+
* @param logs - The logs.
|
|
111
|
+
* @returns The `ReceiptBurned` event.
|
|
112
|
+
*/
|
|
113
|
+
function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
|
|
114
|
+
readonly name: "balanceOf";
|
|
115
|
+
readonly type: "function";
|
|
116
|
+
readonly stateMutability: "view";
|
|
117
|
+
readonly inputs: readonly [{
|
|
118
|
+
readonly type: "bytes";
|
|
119
|
+
readonly name: "receipt";
|
|
120
|
+
}];
|
|
121
|
+
readonly outputs: readonly [{
|
|
122
|
+
readonly type: "uint256";
|
|
123
|
+
readonly name: "amount";
|
|
124
|
+
}];
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "claim";
|
|
127
|
+
readonly type: "function";
|
|
128
|
+
readonly stateMutability: "nonpayable";
|
|
129
|
+
readonly inputs: readonly [{
|
|
130
|
+
readonly type: "address";
|
|
131
|
+
readonly name: "to";
|
|
132
|
+
}, {
|
|
133
|
+
readonly type: "bytes";
|
|
134
|
+
readonly name: "receipt";
|
|
135
|
+
}];
|
|
136
|
+
readonly outputs: readonly [];
|
|
137
|
+
}, {
|
|
138
|
+
readonly name: "burnBlockedReceipt";
|
|
139
|
+
readonly type: "function";
|
|
140
|
+
readonly stateMutability: "nonpayable";
|
|
141
|
+
readonly inputs: readonly [{
|
|
142
|
+
readonly type: "bytes";
|
|
143
|
+
readonly name: "receipt";
|
|
144
|
+
}];
|
|
145
|
+
readonly outputs: readonly [];
|
|
146
|
+
}, {
|
|
147
|
+
readonly name: "TransferBlocked";
|
|
148
|
+
readonly type: "event";
|
|
149
|
+
readonly inputs: readonly [{
|
|
150
|
+
readonly type: "address";
|
|
151
|
+
readonly name: "token";
|
|
152
|
+
readonly indexed: true;
|
|
153
|
+
}, {
|
|
154
|
+
readonly type: "address";
|
|
155
|
+
readonly name: "receiver";
|
|
156
|
+
readonly indexed: true;
|
|
157
|
+
}, {
|
|
158
|
+
readonly type: "uint64";
|
|
159
|
+
readonly name: "blockedNonce";
|
|
160
|
+
readonly indexed: true;
|
|
161
|
+
}, {
|
|
162
|
+
readonly type: "uint256";
|
|
163
|
+
readonly name: "amount";
|
|
164
|
+
}, {
|
|
165
|
+
readonly type: "uint8";
|
|
166
|
+
readonly name: "receiptVersion";
|
|
167
|
+
}, {
|
|
168
|
+
readonly type: "bytes";
|
|
169
|
+
readonly name: "receipt";
|
|
170
|
+
}];
|
|
171
|
+
}, {
|
|
172
|
+
readonly name: "ReceiptClaimed";
|
|
173
|
+
readonly type: "event";
|
|
174
|
+
readonly inputs: readonly [{
|
|
175
|
+
readonly type: "address";
|
|
176
|
+
readonly name: "token";
|
|
177
|
+
readonly indexed: true;
|
|
178
|
+
}, {
|
|
179
|
+
readonly type: "address";
|
|
180
|
+
readonly name: "receiver";
|
|
181
|
+
readonly indexed: true;
|
|
182
|
+
}, {
|
|
183
|
+
readonly type: "uint64";
|
|
184
|
+
readonly name: "blockedNonce";
|
|
185
|
+
readonly indexed: true;
|
|
186
|
+
}, {
|
|
187
|
+
readonly type: "uint64";
|
|
188
|
+
readonly name: "blockedAt";
|
|
189
|
+
}, {
|
|
190
|
+
readonly type: "uint8";
|
|
191
|
+
readonly name: "receiptVersion";
|
|
192
|
+
}, {
|
|
193
|
+
readonly type: "address";
|
|
194
|
+
readonly name: "originator";
|
|
195
|
+
}, {
|
|
196
|
+
readonly type: "address";
|
|
197
|
+
readonly name: "recipient";
|
|
198
|
+
}, {
|
|
199
|
+
readonly type: "address";
|
|
200
|
+
readonly name: "recoveryAuthority";
|
|
201
|
+
}, {
|
|
202
|
+
readonly type: "address";
|
|
203
|
+
readonly name: "caller";
|
|
204
|
+
}, {
|
|
205
|
+
readonly type: "address";
|
|
206
|
+
readonly name: "to";
|
|
207
|
+
}, {
|
|
208
|
+
readonly type: "uint256";
|
|
209
|
+
readonly name: "amount";
|
|
210
|
+
}];
|
|
211
|
+
}, {
|
|
212
|
+
readonly name: "ReceiptBurned";
|
|
213
|
+
readonly type: "event";
|
|
214
|
+
readonly inputs: readonly [{
|
|
215
|
+
readonly type: "address";
|
|
216
|
+
readonly name: "token";
|
|
217
|
+
readonly indexed: true;
|
|
218
|
+
}, {
|
|
219
|
+
readonly type: "address";
|
|
220
|
+
readonly name: "receiver";
|
|
221
|
+
readonly indexed: true;
|
|
222
|
+
}, {
|
|
223
|
+
readonly type: "uint64";
|
|
224
|
+
readonly name: "blockedNonce";
|
|
225
|
+
readonly indexed: true;
|
|
226
|
+
}, {
|
|
227
|
+
readonly type: "uint64";
|
|
228
|
+
readonly name: "blockedAt";
|
|
229
|
+
}, {
|
|
230
|
+
readonly type: "uint8";
|
|
231
|
+
readonly name: "receiptVersion";
|
|
232
|
+
}, {
|
|
233
|
+
readonly type: "address";
|
|
234
|
+
readonly name: "originator";
|
|
235
|
+
}, {
|
|
236
|
+
readonly type: "address";
|
|
237
|
+
readonly name: "recipient";
|
|
238
|
+
}, {
|
|
239
|
+
readonly type: "address";
|
|
240
|
+
readonly name: "recoveryAuthority";
|
|
241
|
+
}, {
|
|
242
|
+
readonly type: "address";
|
|
243
|
+
readonly name: "caller";
|
|
244
|
+
}, {
|
|
245
|
+
readonly type: "uint256";
|
|
246
|
+
readonly name: "amount";
|
|
247
|
+
}];
|
|
248
|
+
}, {
|
|
249
|
+
readonly name: "InvalidReceipt";
|
|
250
|
+
readonly type: "error";
|
|
251
|
+
readonly inputs: readonly [];
|
|
252
|
+
}, {
|
|
253
|
+
readonly name: "InvalidClaimAddress";
|
|
254
|
+
readonly type: "error";
|
|
255
|
+
readonly inputs: readonly [];
|
|
256
|
+
}, {
|
|
257
|
+
readonly name: "UnauthorizedClaimer";
|
|
258
|
+
readonly type: "error";
|
|
259
|
+
readonly inputs: readonly [];
|
|
260
|
+
}, {
|
|
261
|
+
readonly name: "AddressReserved";
|
|
262
|
+
readonly type: "error";
|
|
263
|
+
readonly inputs: readonly [];
|
|
264
|
+
}], "ReceiptBurned">;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Burns the funds backing a blocked receipt and waits for the receipt.
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```ts
|
|
271
|
+
* import { createClient, http } from 'viem'
|
|
272
|
+
* import { tempo } from 'viem/chains'
|
|
273
|
+
* import { Actions } from 'viem/tempo'
|
|
274
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
275
|
+
*
|
|
276
|
+
* const client = createClient({
|
|
277
|
+
* account: privateKeyToAccount('0x...'),
|
|
278
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
279
|
+
* transport: http(),
|
|
280
|
+
* })
|
|
281
|
+
*
|
|
282
|
+
* const { receipt, ...result } = await Actions.receivePolicy.burnSync(client, {
|
|
283
|
+
* receipt: '0x...',
|
|
284
|
+
* })
|
|
285
|
+
* ```
|
|
286
|
+
*
|
|
287
|
+
* @param client - Client.
|
|
288
|
+
* @param parameters - Parameters.
|
|
289
|
+
* @returns The transaction receipt and event data.
|
|
290
|
+
*/
|
|
291
|
+
export declare function burnSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: burnSync.Parameters<chain, account>): Promise<burnSync.ReturnValue>;
|
|
292
|
+
export declare namespace burnSync {
|
|
293
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = burn.Parameters<chain, account>;
|
|
294
|
+
type Args = burn.Args;
|
|
295
|
+
type ReturnValue = Compute<GetEventArgs<typeof Abis.receivePolicyGuard, 'ReceiptBurned', {
|
|
296
|
+
IndexedOnly: false;
|
|
297
|
+
Required: true;
|
|
298
|
+
}> & {
|
|
299
|
+
receipt: TransactionReceipt;
|
|
300
|
+
}>;
|
|
301
|
+
type ErrorType = BaseErrorType;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Claims blocked funds for a receipt, releasing them to a destination.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```ts
|
|
308
|
+
* import { createClient, http } from 'viem'
|
|
309
|
+
* import { tempo } from 'viem/chains'
|
|
310
|
+
* import { Actions } from 'viem/tempo'
|
|
311
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
312
|
+
*
|
|
313
|
+
* const client = createClient({
|
|
314
|
+
* account: privateKeyToAccount('0x...'),
|
|
315
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
316
|
+
* transport: http(),
|
|
317
|
+
* })
|
|
318
|
+
*
|
|
319
|
+
* const hash = await Actions.receivePolicy.claim(client, {
|
|
320
|
+
* to: '0x...',
|
|
321
|
+
* receipt: '0x...',
|
|
322
|
+
* })
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* @param client - Client.
|
|
326
|
+
* @param parameters - Parameters.
|
|
327
|
+
* @returns The transaction hash.
|
|
328
|
+
*/
|
|
329
|
+
export declare function claim<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: claim.Parameters<chain, account>): Promise<claim.ReturnValue>;
|
|
330
|
+
export declare namespace claim {
|
|
331
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
|
|
332
|
+
type Args = {
|
|
333
|
+
/** Destination to release the blocked funds to. */
|
|
334
|
+
to: Address;
|
|
335
|
+
/** The encoded claim receipt (witness from a `TransferBlocked` event). */
|
|
336
|
+
receipt: Hex;
|
|
337
|
+
};
|
|
338
|
+
type ReturnValue = WriteContractReturnType;
|
|
339
|
+
type ErrorType = BaseErrorType;
|
|
340
|
+
/** @internal */
|
|
341
|
+
function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: Parameters<chain, account>): Promise<ReturnType<action>>;
|
|
342
|
+
/**
|
|
343
|
+
* Defines a call to the `claim` function.
|
|
344
|
+
*
|
|
345
|
+
* @param args - Arguments.
|
|
346
|
+
* @returns The call.
|
|
347
|
+
*/
|
|
348
|
+
function call(args: Args): {
|
|
349
|
+
abi: [{
|
|
350
|
+
readonly name: "claim";
|
|
351
|
+
readonly type: "function";
|
|
352
|
+
readonly stateMutability: "nonpayable";
|
|
353
|
+
readonly inputs: readonly [{
|
|
354
|
+
readonly type: "address";
|
|
355
|
+
readonly name: "to";
|
|
356
|
+
}, {
|
|
357
|
+
readonly type: "bytes";
|
|
358
|
+
readonly name: "receipt";
|
|
359
|
+
}];
|
|
360
|
+
readonly outputs: readonly [];
|
|
361
|
+
}];
|
|
362
|
+
functionName: "claim";
|
|
363
|
+
} & {
|
|
364
|
+
args: readonly [to: `0x${string}`, `0x${string}`];
|
|
365
|
+
} & {
|
|
366
|
+
address: Address;
|
|
367
|
+
} & {
|
|
368
|
+
data: Hex;
|
|
369
|
+
to: Address;
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* Extracts the `ReceiptClaimed` event from logs.
|
|
373
|
+
*
|
|
374
|
+
* @param logs - The logs.
|
|
375
|
+
* @returns The `ReceiptClaimed` event.
|
|
376
|
+
*/
|
|
377
|
+
function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
|
|
378
|
+
readonly name: "balanceOf";
|
|
379
|
+
readonly type: "function";
|
|
380
|
+
readonly stateMutability: "view";
|
|
381
|
+
readonly inputs: readonly [{
|
|
382
|
+
readonly type: "bytes";
|
|
383
|
+
readonly name: "receipt";
|
|
384
|
+
}];
|
|
385
|
+
readonly outputs: readonly [{
|
|
386
|
+
readonly type: "uint256";
|
|
387
|
+
readonly name: "amount";
|
|
388
|
+
}];
|
|
389
|
+
}, {
|
|
390
|
+
readonly name: "claim";
|
|
391
|
+
readonly type: "function";
|
|
392
|
+
readonly stateMutability: "nonpayable";
|
|
393
|
+
readonly inputs: readonly [{
|
|
394
|
+
readonly type: "address";
|
|
395
|
+
readonly name: "to";
|
|
396
|
+
}, {
|
|
397
|
+
readonly type: "bytes";
|
|
398
|
+
readonly name: "receipt";
|
|
399
|
+
}];
|
|
400
|
+
readonly outputs: readonly [];
|
|
401
|
+
}, {
|
|
402
|
+
readonly name: "burnBlockedReceipt";
|
|
403
|
+
readonly type: "function";
|
|
404
|
+
readonly stateMutability: "nonpayable";
|
|
405
|
+
readonly inputs: readonly [{
|
|
406
|
+
readonly type: "bytes";
|
|
407
|
+
readonly name: "receipt";
|
|
408
|
+
}];
|
|
409
|
+
readonly outputs: readonly [];
|
|
410
|
+
}, {
|
|
411
|
+
readonly name: "TransferBlocked";
|
|
412
|
+
readonly type: "event";
|
|
413
|
+
readonly inputs: readonly [{
|
|
414
|
+
readonly type: "address";
|
|
415
|
+
readonly name: "token";
|
|
416
|
+
readonly indexed: true;
|
|
417
|
+
}, {
|
|
418
|
+
readonly type: "address";
|
|
419
|
+
readonly name: "receiver";
|
|
420
|
+
readonly indexed: true;
|
|
421
|
+
}, {
|
|
422
|
+
readonly type: "uint64";
|
|
423
|
+
readonly name: "blockedNonce";
|
|
424
|
+
readonly indexed: true;
|
|
425
|
+
}, {
|
|
426
|
+
readonly type: "uint256";
|
|
427
|
+
readonly name: "amount";
|
|
428
|
+
}, {
|
|
429
|
+
readonly type: "uint8";
|
|
430
|
+
readonly name: "receiptVersion";
|
|
431
|
+
}, {
|
|
432
|
+
readonly type: "bytes";
|
|
433
|
+
readonly name: "receipt";
|
|
434
|
+
}];
|
|
435
|
+
}, {
|
|
436
|
+
readonly name: "ReceiptClaimed";
|
|
437
|
+
readonly type: "event";
|
|
438
|
+
readonly inputs: readonly [{
|
|
439
|
+
readonly type: "address";
|
|
440
|
+
readonly name: "token";
|
|
441
|
+
readonly indexed: true;
|
|
442
|
+
}, {
|
|
443
|
+
readonly type: "address";
|
|
444
|
+
readonly name: "receiver";
|
|
445
|
+
readonly indexed: true;
|
|
446
|
+
}, {
|
|
447
|
+
readonly type: "uint64";
|
|
448
|
+
readonly name: "blockedNonce";
|
|
449
|
+
readonly indexed: true;
|
|
450
|
+
}, {
|
|
451
|
+
readonly type: "uint64";
|
|
452
|
+
readonly name: "blockedAt";
|
|
453
|
+
}, {
|
|
454
|
+
readonly type: "uint8";
|
|
455
|
+
readonly name: "receiptVersion";
|
|
456
|
+
}, {
|
|
457
|
+
readonly type: "address";
|
|
458
|
+
readonly name: "originator";
|
|
459
|
+
}, {
|
|
460
|
+
readonly type: "address";
|
|
461
|
+
readonly name: "recipient";
|
|
462
|
+
}, {
|
|
463
|
+
readonly type: "address";
|
|
464
|
+
readonly name: "recoveryAuthority";
|
|
465
|
+
}, {
|
|
466
|
+
readonly type: "address";
|
|
467
|
+
readonly name: "caller";
|
|
468
|
+
}, {
|
|
469
|
+
readonly type: "address";
|
|
470
|
+
readonly name: "to";
|
|
471
|
+
}, {
|
|
472
|
+
readonly type: "uint256";
|
|
473
|
+
readonly name: "amount";
|
|
474
|
+
}];
|
|
475
|
+
}, {
|
|
476
|
+
readonly name: "ReceiptBurned";
|
|
477
|
+
readonly type: "event";
|
|
478
|
+
readonly inputs: readonly [{
|
|
479
|
+
readonly type: "address";
|
|
480
|
+
readonly name: "token";
|
|
481
|
+
readonly indexed: true;
|
|
482
|
+
}, {
|
|
483
|
+
readonly type: "address";
|
|
484
|
+
readonly name: "receiver";
|
|
485
|
+
readonly indexed: true;
|
|
486
|
+
}, {
|
|
487
|
+
readonly type: "uint64";
|
|
488
|
+
readonly name: "blockedNonce";
|
|
489
|
+
readonly indexed: true;
|
|
490
|
+
}, {
|
|
491
|
+
readonly type: "uint64";
|
|
492
|
+
readonly name: "blockedAt";
|
|
493
|
+
}, {
|
|
494
|
+
readonly type: "uint8";
|
|
495
|
+
readonly name: "receiptVersion";
|
|
496
|
+
}, {
|
|
497
|
+
readonly type: "address";
|
|
498
|
+
readonly name: "originator";
|
|
499
|
+
}, {
|
|
500
|
+
readonly type: "address";
|
|
501
|
+
readonly name: "recipient";
|
|
502
|
+
}, {
|
|
503
|
+
readonly type: "address";
|
|
504
|
+
readonly name: "recoveryAuthority";
|
|
505
|
+
}, {
|
|
506
|
+
readonly type: "address";
|
|
507
|
+
readonly name: "caller";
|
|
508
|
+
}, {
|
|
509
|
+
readonly type: "uint256";
|
|
510
|
+
readonly name: "amount";
|
|
511
|
+
}];
|
|
512
|
+
}, {
|
|
513
|
+
readonly name: "InvalidReceipt";
|
|
514
|
+
readonly type: "error";
|
|
515
|
+
readonly inputs: readonly [];
|
|
516
|
+
}, {
|
|
517
|
+
readonly name: "InvalidClaimAddress";
|
|
518
|
+
readonly type: "error";
|
|
519
|
+
readonly inputs: readonly [];
|
|
520
|
+
}, {
|
|
521
|
+
readonly name: "UnauthorizedClaimer";
|
|
522
|
+
readonly type: "error";
|
|
523
|
+
readonly inputs: readonly [];
|
|
524
|
+
}, {
|
|
525
|
+
readonly name: "AddressReserved";
|
|
526
|
+
readonly type: "error";
|
|
527
|
+
readonly inputs: readonly [];
|
|
528
|
+
}], "ReceiptClaimed">;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Claims blocked funds for a receipt and waits for the receipt.
|
|
532
|
+
*
|
|
533
|
+
* @example
|
|
534
|
+
* ```ts
|
|
535
|
+
* import { createClient, http } from 'viem'
|
|
536
|
+
* import { tempo } from 'viem/chains'
|
|
537
|
+
* import { Actions } from 'viem/tempo'
|
|
538
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
539
|
+
*
|
|
540
|
+
* const client = createClient({
|
|
541
|
+
* account: privateKeyToAccount('0x...'),
|
|
542
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
543
|
+
* transport: http(),
|
|
544
|
+
* })
|
|
545
|
+
*
|
|
546
|
+
* const { receipt, ...result } = await Actions.receivePolicy.claimSync(client, {
|
|
547
|
+
* to: '0x...',
|
|
548
|
+
* receipt: '0x...',
|
|
549
|
+
* })
|
|
550
|
+
* ```
|
|
551
|
+
*
|
|
552
|
+
* @param client - Client.
|
|
553
|
+
* @param parameters - Parameters.
|
|
554
|
+
* @returns The transaction receipt and event data.
|
|
555
|
+
*/
|
|
556
|
+
export declare function claimSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: claimSync.Parameters<chain, account>): Promise<claimSync.ReturnValue>;
|
|
557
|
+
export declare namespace claimSync {
|
|
558
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = claim.Parameters<chain, account>;
|
|
559
|
+
type Args = claim.Args;
|
|
560
|
+
type ReturnValue = Compute<GetEventArgs<typeof Abis.receivePolicyGuard, 'ReceiptClaimed', {
|
|
561
|
+
IndexedOnly: false;
|
|
562
|
+
Required: true;
|
|
563
|
+
}> & {
|
|
564
|
+
receipt: TransactionReceipt;
|
|
565
|
+
}>;
|
|
566
|
+
type ErrorType = BaseErrorType;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Gets the receive policy configured for an account.
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* ```ts
|
|
573
|
+
* import { createClient, http } from 'viem'
|
|
574
|
+
* import { tempo } from 'viem/chains'
|
|
575
|
+
* import { Actions } from 'viem/tempo'
|
|
576
|
+
*
|
|
577
|
+
* const client = createClient({
|
|
578
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
579
|
+
* transport: http(),
|
|
580
|
+
* })
|
|
581
|
+
*
|
|
582
|
+
* const policy = await Actions.receivePolicy.get(client, {
|
|
583
|
+
* account: '0x...',
|
|
584
|
+
* })
|
|
585
|
+
* ```
|
|
586
|
+
*
|
|
587
|
+
* @param client - Client.
|
|
588
|
+
* @param parameters - Parameters.
|
|
589
|
+
* @returns The receive policy.
|
|
590
|
+
*/
|
|
591
|
+
export declare function get<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: get.Parameters<account>): Promise<get.ReturnValue>;
|
|
592
|
+
export declare namespace get {
|
|
593
|
+
type Parameters<account extends Account | undefined = Account | undefined> = ReadParameters & GetAccountParameter<account>;
|
|
594
|
+
type Args = {
|
|
595
|
+
/** Account address. */
|
|
596
|
+
account: Address;
|
|
597
|
+
};
|
|
598
|
+
type ReturnValue = Compute<{
|
|
599
|
+
/** Whether the account has a receive policy configured. */
|
|
600
|
+
hasReceivePolicy: boolean;
|
|
601
|
+
/** TIP-403 policy restricting which senders are allowed. */
|
|
602
|
+
senderPolicyId: PolicyRef;
|
|
603
|
+
/** Type of the sender policy. */
|
|
604
|
+
senderPolicyType: PolicyType;
|
|
605
|
+
/** TIP-403 policy restricting which tokens are allowed. */
|
|
606
|
+
tokenPolicyId: PolicyRef;
|
|
607
|
+
/** Type of the token policy. */
|
|
608
|
+
tokenPolicyType: PolicyType;
|
|
609
|
+
/** Who can reclaim funds blocked by this policy. */
|
|
610
|
+
claimer: Claimer;
|
|
611
|
+
/** Raw recovery authority address. */
|
|
612
|
+
recoveryAuthority: Address;
|
|
613
|
+
}>;
|
|
614
|
+
/**
|
|
615
|
+
* Defines a call to the `receivePolicy` function.
|
|
616
|
+
*
|
|
617
|
+
* @param args - Arguments.
|
|
618
|
+
* @returns The call.
|
|
619
|
+
*/
|
|
620
|
+
function call(args: Args): {
|
|
621
|
+
abi: [{
|
|
622
|
+
readonly name: "receivePolicy";
|
|
623
|
+
readonly type: "function";
|
|
624
|
+
readonly stateMutability: "view";
|
|
625
|
+
readonly inputs: readonly [{
|
|
626
|
+
readonly type: "address";
|
|
627
|
+
readonly name: "account";
|
|
628
|
+
}];
|
|
629
|
+
readonly outputs: readonly [{
|
|
630
|
+
readonly type: "bool";
|
|
631
|
+
readonly name: "hasReceivePolicy";
|
|
632
|
+
}, {
|
|
633
|
+
readonly type: "uint64";
|
|
634
|
+
readonly name: "senderPolicyId";
|
|
635
|
+
}, {
|
|
636
|
+
readonly type: "uint8";
|
|
637
|
+
readonly name: "senderPolicyType";
|
|
638
|
+
}, {
|
|
639
|
+
readonly type: "uint64";
|
|
640
|
+
readonly name: "tokenFilterId";
|
|
641
|
+
}, {
|
|
642
|
+
readonly type: "uint8";
|
|
643
|
+
readonly name: "tokenFilterType";
|
|
644
|
+
}, {
|
|
645
|
+
readonly type: "address";
|
|
646
|
+
readonly name: "recoveryAuthority";
|
|
647
|
+
}];
|
|
648
|
+
}];
|
|
649
|
+
functionName: "receivePolicy";
|
|
650
|
+
} & {
|
|
651
|
+
args: readonly [account: `0x${string}`];
|
|
652
|
+
} & {
|
|
653
|
+
address: Address;
|
|
654
|
+
} & {
|
|
655
|
+
data: Hex;
|
|
656
|
+
to: Address;
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Gets the blocked balance for an encoded receipt.
|
|
661
|
+
*
|
|
662
|
+
* @example
|
|
663
|
+
* ```ts
|
|
664
|
+
* import { createClient, http } from 'viem'
|
|
665
|
+
* import { tempo } from 'viem/chains'
|
|
666
|
+
* import { Actions } from 'viem/tempo'
|
|
667
|
+
*
|
|
668
|
+
* const client = createClient({
|
|
669
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
670
|
+
* transport: http(),
|
|
671
|
+
* })
|
|
672
|
+
*
|
|
673
|
+
* const amount = await Actions.receivePolicy.getBlockedBalance(client, {
|
|
674
|
+
* receipt: '0x...',
|
|
675
|
+
* })
|
|
676
|
+
* ```
|
|
677
|
+
*
|
|
678
|
+
* @param client - Client.
|
|
679
|
+
* @param parameters - Parameters.
|
|
680
|
+
* @returns The blocked amount for the receipt.
|
|
681
|
+
*/
|
|
682
|
+
export declare function getBlockedBalance<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: getBlockedBalance.Parameters): Promise<getBlockedBalance.ReturnValue>;
|
|
683
|
+
export declare namespace getBlockedBalance {
|
|
684
|
+
type Parameters = ReadParameters & Args;
|
|
685
|
+
type Args = {
|
|
686
|
+
/** The encoded claim receipt. */
|
|
687
|
+
receipt: Hex;
|
|
688
|
+
};
|
|
689
|
+
type ReturnValue = ReadContractReturnType<typeof Abis.receivePolicyGuard, 'balanceOf', never>;
|
|
690
|
+
/**
|
|
691
|
+
* Defines a call to the `balanceOf` function.
|
|
692
|
+
*
|
|
693
|
+
* @param args - Arguments.
|
|
694
|
+
* @returns The call.
|
|
695
|
+
*/
|
|
696
|
+
function call(args: Args): {
|
|
697
|
+
abi: [{
|
|
698
|
+
readonly name: "balanceOf";
|
|
699
|
+
readonly type: "function";
|
|
700
|
+
readonly stateMutability: "view";
|
|
701
|
+
readonly inputs: readonly [{
|
|
702
|
+
readonly type: "bytes";
|
|
703
|
+
readonly name: "receipt";
|
|
704
|
+
}];
|
|
705
|
+
readonly outputs: readonly [{
|
|
706
|
+
readonly type: "uint256";
|
|
707
|
+
readonly name: "amount";
|
|
708
|
+
}];
|
|
709
|
+
}];
|
|
710
|
+
functionName: "balanceOf";
|
|
711
|
+
} & {
|
|
712
|
+
args: readonly [`0x${string}`];
|
|
713
|
+
} & {
|
|
714
|
+
address: Address;
|
|
715
|
+
} & {
|
|
716
|
+
data: Hex;
|
|
717
|
+
to: Address;
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Sets the receive policy for the calling account.
|
|
722
|
+
*
|
|
723
|
+
* A receive policy controls which TIP-20 tokens and which senders an account
|
|
724
|
+
* accepts. Inbound transfers and mints that violate the policy are not
|
|
725
|
+
* reverted – instead the funds are redirected to the `ReceivePolicyGuard` and
|
|
726
|
+
* can be reclaimed later (see {@link claim}).
|
|
727
|
+
*
|
|
728
|
+
* @example
|
|
729
|
+
* ```ts
|
|
730
|
+
* import { createClient, http } from 'viem'
|
|
731
|
+
* import { tempo } from 'viem/chains'
|
|
732
|
+
* import { Actions } from 'viem/tempo'
|
|
733
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
734
|
+
*
|
|
735
|
+
* const client = createClient({
|
|
736
|
+
* account: privateKeyToAccount('0x...'),
|
|
737
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
738
|
+
* transport: http(),
|
|
739
|
+
* })
|
|
740
|
+
*
|
|
741
|
+
* const hash = await Actions.receivePolicy.set(client, {
|
|
742
|
+
* senderPolicyId: 'allow-all',
|
|
743
|
+
* tokenPolicyId: 'allow-all',
|
|
744
|
+
* claimer: 'self',
|
|
745
|
+
* })
|
|
746
|
+
* ```
|
|
747
|
+
*
|
|
748
|
+
* @param client - Client.
|
|
749
|
+
* @param parameters - Parameters.
|
|
750
|
+
* @returns The transaction hash.
|
|
751
|
+
*/
|
|
752
|
+
export declare function set<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: set.Parameters<chain, account>): Promise<set.ReturnValue>;
|
|
753
|
+
export declare namespace set {
|
|
754
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Omit<Args, 'recoveryAuthority'>;
|
|
755
|
+
type Args = {
|
|
756
|
+
/**
|
|
757
|
+
* TIP-403 policy restricting which senders are allowed.
|
|
758
|
+
* @default 'allow-all'
|
|
759
|
+
*/
|
|
760
|
+
senderPolicyId?: PolicyRef | undefined;
|
|
761
|
+
/**
|
|
762
|
+
* TIP-403 policy restricting which tokens are allowed.
|
|
763
|
+
* @default 'allow-all'
|
|
764
|
+
*/
|
|
765
|
+
tokenPolicyId?: PolicyRef | undefined;
|
|
766
|
+
/**
|
|
767
|
+
* Who can reclaim funds blocked by this policy.
|
|
768
|
+
* @default 'sender'
|
|
769
|
+
*/
|
|
770
|
+
claimer?: Claimer | undefined;
|
|
771
|
+
};
|
|
772
|
+
type ReturnValue = WriteContractReturnType;
|
|
773
|
+
type ErrorType = BaseErrorType;
|
|
774
|
+
/** @internal */
|
|
775
|
+
function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: Parameters<chain, account>): Promise<ReturnType<action>>;
|
|
776
|
+
/**
|
|
777
|
+
* Defines a call to the `setReceivePolicy` function.
|
|
778
|
+
*
|
|
779
|
+
* @param args - Arguments.
|
|
780
|
+
* @returns The call.
|
|
781
|
+
*/
|
|
782
|
+
function call(args: {
|
|
783
|
+
/** Resolved TIP-403 sender policy id. */
|
|
784
|
+
senderPolicyId: bigint;
|
|
785
|
+
/** Resolved TIP-403 token filter id. */
|
|
786
|
+
tokenFilterId: bigint;
|
|
787
|
+
/** Resolved recovery authority. */
|
|
788
|
+
recoveryAuthority: Address;
|
|
789
|
+
}): {
|
|
790
|
+
abi: [{
|
|
791
|
+
readonly name: "setReceivePolicy";
|
|
792
|
+
readonly type: "function";
|
|
793
|
+
readonly stateMutability: "nonpayable";
|
|
794
|
+
readonly inputs: readonly [{
|
|
795
|
+
readonly type: "uint64";
|
|
796
|
+
readonly name: "senderPolicyId";
|
|
797
|
+
}, {
|
|
798
|
+
readonly type: "uint64";
|
|
799
|
+
readonly name: "tokenFilterId";
|
|
800
|
+
}, {
|
|
801
|
+
readonly type: "address";
|
|
802
|
+
readonly name: "recoveryAuthority";
|
|
803
|
+
}];
|
|
804
|
+
readonly outputs: readonly [];
|
|
805
|
+
}];
|
|
806
|
+
functionName: "setReceivePolicy";
|
|
807
|
+
} & {
|
|
808
|
+
args: readonly [bigint, bigint, `0x${string}`];
|
|
809
|
+
} & {
|
|
810
|
+
address: Address;
|
|
811
|
+
} & {
|
|
812
|
+
data: Hex;
|
|
813
|
+
to: Address;
|
|
814
|
+
};
|
|
815
|
+
/**
|
|
816
|
+
* Extracts the `ReceivePolicyUpdated` event from logs.
|
|
817
|
+
*
|
|
818
|
+
* @param logs - The logs.
|
|
819
|
+
* @returns The `ReceivePolicyUpdated` event.
|
|
820
|
+
*/
|
|
821
|
+
function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
|
|
822
|
+
readonly name: "policyIdCounter";
|
|
823
|
+
readonly type: "function";
|
|
824
|
+
readonly stateMutability: "view";
|
|
825
|
+
readonly inputs: readonly [];
|
|
826
|
+
readonly outputs: readonly [{
|
|
827
|
+
readonly type: "uint64";
|
|
828
|
+
}];
|
|
829
|
+
}, {
|
|
830
|
+
readonly name: "policyExists";
|
|
831
|
+
readonly type: "function";
|
|
832
|
+
readonly stateMutability: "view";
|
|
833
|
+
readonly inputs: readonly [{
|
|
834
|
+
readonly type: "uint64";
|
|
835
|
+
readonly name: "policyId";
|
|
836
|
+
}];
|
|
837
|
+
readonly outputs: readonly [{
|
|
838
|
+
readonly type: "bool";
|
|
839
|
+
}];
|
|
840
|
+
}, {
|
|
841
|
+
readonly name: "policyData";
|
|
842
|
+
readonly type: "function";
|
|
843
|
+
readonly stateMutability: "view";
|
|
844
|
+
readonly inputs: readonly [{
|
|
845
|
+
readonly type: "uint64";
|
|
846
|
+
readonly name: "policyId";
|
|
847
|
+
}];
|
|
848
|
+
readonly outputs: readonly [{
|
|
849
|
+
readonly type: "uint8";
|
|
850
|
+
readonly name: "policyType";
|
|
851
|
+
}, {
|
|
852
|
+
readonly type: "address";
|
|
853
|
+
readonly name: "admin";
|
|
854
|
+
}];
|
|
855
|
+
}, {
|
|
856
|
+
readonly name: "isAuthorized";
|
|
857
|
+
readonly type: "function";
|
|
858
|
+
readonly stateMutability: "view";
|
|
859
|
+
readonly inputs: readonly [{
|
|
860
|
+
readonly type: "uint64";
|
|
861
|
+
readonly name: "policyId";
|
|
862
|
+
}, {
|
|
863
|
+
readonly type: "address";
|
|
864
|
+
readonly name: "user";
|
|
865
|
+
}];
|
|
866
|
+
readonly outputs: readonly [{
|
|
867
|
+
readonly type: "bool";
|
|
868
|
+
}];
|
|
869
|
+
}, {
|
|
870
|
+
readonly name: "isAuthorizedSender";
|
|
871
|
+
readonly type: "function";
|
|
872
|
+
readonly stateMutability: "view";
|
|
873
|
+
readonly inputs: readonly [{
|
|
874
|
+
readonly type: "uint64";
|
|
875
|
+
readonly name: "policyId";
|
|
876
|
+
}, {
|
|
877
|
+
readonly type: "address";
|
|
878
|
+
readonly name: "user";
|
|
879
|
+
}];
|
|
880
|
+
readonly outputs: readonly [{
|
|
881
|
+
readonly type: "bool";
|
|
882
|
+
}];
|
|
883
|
+
}, {
|
|
884
|
+
readonly name: "isAuthorizedRecipient";
|
|
885
|
+
readonly type: "function";
|
|
886
|
+
readonly stateMutability: "view";
|
|
887
|
+
readonly inputs: readonly [{
|
|
888
|
+
readonly type: "uint64";
|
|
889
|
+
readonly name: "policyId";
|
|
890
|
+
}, {
|
|
891
|
+
readonly type: "address";
|
|
892
|
+
readonly name: "user";
|
|
893
|
+
}];
|
|
894
|
+
readonly outputs: readonly [{
|
|
895
|
+
readonly type: "bool";
|
|
896
|
+
}];
|
|
897
|
+
}, {
|
|
898
|
+
readonly name: "isAuthorizedMintRecipient";
|
|
899
|
+
readonly type: "function";
|
|
900
|
+
readonly stateMutability: "view";
|
|
901
|
+
readonly inputs: readonly [{
|
|
902
|
+
readonly type: "uint64";
|
|
903
|
+
readonly name: "policyId";
|
|
904
|
+
}, {
|
|
905
|
+
readonly type: "address";
|
|
906
|
+
readonly name: "user";
|
|
907
|
+
}];
|
|
908
|
+
readonly outputs: readonly [{
|
|
909
|
+
readonly type: "bool";
|
|
910
|
+
}];
|
|
911
|
+
}, {
|
|
912
|
+
readonly name: "compoundPolicyData";
|
|
913
|
+
readonly type: "function";
|
|
914
|
+
readonly stateMutability: "view";
|
|
915
|
+
readonly inputs: readonly [{
|
|
916
|
+
readonly type: "uint64";
|
|
917
|
+
readonly name: "policyId";
|
|
918
|
+
}];
|
|
919
|
+
readonly outputs: readonly [{
|
|
920
|
+
readonly type: "uint64";
|
|
921
|
+
readonly name: "senderPolicyId";
|
|
922
|
+
}, {
|
|
923
|
+
readonly type: "uint64";
|
|
924
|
+
readonly name: "recipientPolicyId";
|
|
925
|
+
}, {
|
|
926
|
+
readonly type: "uint64";
|
|
927
|
+
readonly name: "mintRecipientPolicyId";
|
|
928
|
+
}];
|
|
929
|
+
}, {
|
|
930
|
+
readonly name: "receivePolicy";
|
|
931
|
+
readonly type: "function";
|
|
932
|
+
readonly stateMutability: "view";
|
|
933
|
+
readonly inputs: readonly [{
|
|
934
|
+
readonly type: "address";
|
|
935
|
+
readonly name: "account";
|
|
936
|
+
}];
|
|
937
|
+
readonly outputs: readonly [{
|
|
938
|
+
readonly type: "bool";
|
|
939
|
+
readonly name: "hasReceivePolicy";
|
|
940
|
+
}, {
|
|
941
|
+
readonly type: "uint64";
|
|
942
|
+
readonly name: "senderPolicyId";
|
|
943
|
+
}, {
|
|
944
|
+
readonly type: "uint8";
|
|
945
|
+
readonly name: "senderPolicyType";
|
|
946
|
+
}, {
|
|
947
|
+
readonly type: "uint64";
|
|
948
|
+
readonly name: "tokenFilterId";
|
|
949
|
+
}, {
|
|
950
|
+
readonly type: "uint8";
|
|
951
|
+
readonly name: "tokenFilterType";
|
|
952
|
+
}, {
|
|
953
|
+
readonly type: "address";
|
|
954
|
+
readonly name: "recoveryAuthority";
|
|
955
|
+
}];
|
|
956
|
+
}, {
|
|
957
|
+
readonly name: "validateReceivePolicy";
|
|
958
|
+
readonly type: "function";
|
|
959
|
+
readonly stateMutability: "view";
|
|
960
|
+
readonly inputs: readonly [{
|
|
961
|
+
readonly type: "address";
|
|
962
|
+
readonly name: "token";
|
|
963
|
+
}, {
|
|
964
|
+
readonly type: "address";
|
|
965
|
+
readonly name: "sender";
|
|
966
|
+
}, {
|
|
967
|
+
readonly type: "address";
|
|
968
|
+
readonly name: "receiver";
|
|
969
|
+
}];
|
|
970
|
+
readonly outputs: readonly [{
|
|
971
|
+
readonly type: "bool";
|
|
972
|
+
readonly name: "authorized";
|
|
973
|
+
}, {
|
|
974
|
+
readonly type: "uint8";
|
|
975
|
+
readonly name: "blockedReason";
|
|
976
|
+
}];
|
|
977
|
+
}, {
|
|
978
|
+
readonly name: "createPolicy";
|
|
979
|
+
readonly type: "function";
|
|
980
|
+
readonly stateMutability: "nonpayable";
|
|
981
|
+
readonly inputs: readonly [{
|
|
982
|
+
readonly type: "address";
|
|
983
|
+
readonly name: "admin";
|
|
984
|
+
}, {
|
|
985
|
+
readonly type: "uint8";
|
|
986
|
+
readonly name: "policyType";
|
|
987
|
+
}];
|
|
988
|
+
readonly outputs: readonly [{
|
|
989
|
+
readonly type: "uint64";
|
|
990
|
+
}];
|
|
991
|
+
}, {
|
|
992
|
+
readonly name: "createPolicyWithAccounts";
|
|
993
|
+
readonly type: "function";
|
|
994
|
+
readonly stateMutability: "nonpayable";
|
|
995
|
+
readonly inputs: readonly [{
|
|
996
|
+
readonly type: "address";
|
|
997
|
+
readonly name: "admin";
|
|
998
|
+
}, {
|
|
999
|
+
readonly type: "uint8";
|
|
1000
|
+
readonly name: "policyType";
|
|
1001
|
+
}, {
|
|
1002
|
+
readonly type: "address[]";
|
|
1003
|
+
readonly name: "accounts";
|
|
1004
|
+
}];
|
|
1005
|
+
readonly outputs: readonly [{
|
|
1006
|
+
readonly type: "uint64";
|
|
1007
|
+
}];
|
|
1008
|
+
}, {
|
|
1009
|
+
readonly name: "setPolicyAdmin";
|
|
1010
|
+
readonly type: "function";
|
|
1011
|
+
readonly stateMutability: "nonpayable";
|
|
1012
|
+
readonly inputs: readonly [{
|
|
1013
|
+
readonly type: "uint64";
|
|
1014
|
+
readonly name: "policyId";
|
|
1015
|
+
}, {
|
|
1016
|
+
readonly type: "address";
|
|
1017
|
+
readonly name: "admin";
|
|
1018
|
+
}];
|
|
1019
|
+
readonly outputs: readonly [];
|
|
1020
|
+
}, {
|
|
1021
|
+
readonly name: "modifyPolicyWhitelist";
|
|
1022
|
+
readonly type: "function";
|
|
1023
|
+
readonly stateMutability: "nonpayable";
|
|
1024
|
+
readonly inputs: readonly [{
|
|
1025
|
+
readonly type: "uint64";
|
|
1026
|
+
readonly name: "policyId";
|
|
1027
|
+
}, {
|
|
1028
|
+
readonly type: "address";
|
|
1029
|
+
readonly name: "account";
|
|
1030
|
+
}, {
|
|
1031
|
+
readonly type: "bool";
|
|
1032
|
+
readonly name: "allowed";
|
|
1033
|
+
}];
|
|
1034
|
+
readonly outputs: readonly [];
|
|
1035
|
+
}, {
|
|
1036
|
+
readonly name: "modifyPolicyBlacklist";
|
|
1037
|
+
readonly type: "function";
|
|
1038
|
+
readonly stateMutability: "nonpayable";
|
|
1039
|
+
readonly inputs: readonly [{
|
|
1040
|
+
readonly type: "uint64";
|
|
1041
|
+
readonly name: "policyId";
|
|
1042
|
+
}, {
|
|
1043
|
+
readonly type: "address";
|
|
1044
|
+
readonly name: "account";
|
|
1045
|
+
}, {
|
|
1046
|
+
readonly type: "bool";
|
|
1047
|
+
readonly name: "restricted";
|
|
1048
|
+
}];
|
|
1049
|
+
readonly outputs: readonly [];
|
|
1050
|
+
}, {
|
|
1051
|
+
readonly name: "createCompoundPolicy";
|
|
1052
|
+
readonly type: "function";
|
|
1053
|
+
readonly stateMutability: "nonpayable";
|
|
1054
|
+
readonly inputs: readonly [{
|
|
1055
|
+
readonly type: "uint64";
|
|
1056
|
+
readonly name: "senderPolicyId";
|
|
1057
|
+
}, {
|
|
1058
|
+
readonly type: "uint64";
|
|
1059
|
+
readonly name: "recipientPolicyId";
|
|
1060
|
+
}, {
|
|
1061
|
+
readonly type: "uint64";
|
|
1062
|
+
readonly name: "mintRecipientPolicyId";
|
|
1063
|
+
}];
|
|
1064
|
+
readonly outputs: readonly [{
|
|
1065
|
+
readonly type: "uint64";
|
|
1066
|
+
}];
|
|
1067
|
+
}, {
|
|
1068
|
+
readonly name: "setReceivePolicy";
|
|
1069
|
+
readonly type: "function";
|
|
1070
|
+
readonly stateMutability: "nonpayable";
|
|
1071
|
+
readonly inputs: readonly [{
|
|
1072
|
+
readonly type: "uint64";
|
|
1073
|
+
readonly name: "senderPolicyId";
|
|
1074
|
+
}, {
|
|
1075
|
+
readonly type: "uint64";
|
|
1076
|
+
readonly name: "tokenFilterId";
|
|
1077
|
+
}, {
|
|
1078
|
+
readonly type: "address";
|
|
1079
|
+
readonly name: "recoveryAuthority";
|
|
1080
|
+
}];
|
|
1081
|
+
readonly outputs: readonly [];
|
|
1082
|
+
}, {
|
|
1083
|
+
readonly name: "PolicyAdminUpdated";
|
|
1084
|
+
readonly type: "event";
|
|
1085
|
+
readonly inputs: readonly [{
|
|
1086
|
+
readonly type: "uint64";
|
|
1087
|
+
readonly name: "policyId";
|
|
1088
|
+
readonly indexed: true;
|
|
1089
|
+
}, {
|
|
1090
|
+
readonly type: "address";
|
|
1091
|
+
readonly name: "updater";
|
|
1092
|
+
readonly indexed: true;
|
|
1093
|
+
}, {
|
|
1094
|
+
readonly type: "address";
|
|
1095
|
+
readonly name: "admin";
|
|
1096
|
+
readonly indexed: true;
|
|
1097
|
+
}];
|
|
1098
|
+
}, {
|
|
1099
|
+
readonly name: "PolicyCreated";
|
|
1100
|
+
readonly type: "event";
|
|
1101
|
+
readonly inputs: readonly [{
|
|
1102
|
+
readonly type: "uint64";
|
|
1103
|
+
readonly name: "policyId";
|
|
1104
|
+
readonly indexed: true;
|
|
1105
|
+
}, {
|
|
1106
|
+
readonly type: "address";
|
|
1107
|
+
readonly name: "updater";
|
|
1108
|
+
readonly indexed: true;
|
|
1109
|
+
}, {
|
|
1110
|
+
readonly type: "uint8";
|
|
1111
|
+
readonly name: "policyType";
|
|
1112
|
+
}];
|
|
1113
|
+
}, {
|
|
1114
|
+
readonly name: "WhitelistUpdated";
|
|
1115
|
+
readonly type: "event";
|
|
1116
|
+
readonly inputs: readonly [{
|
|
1117
|
+
readonly type: "uint64";
|
|
1118
|
+
readonly name: "policyId";
|
|
1119
|
+
readonly indexed: true;
|
|
1120
|
+
}, {
|
|
1121
|
+
readonly type: "address";
|
|
1122
|
+
readonly name: "updater";
|
|
1123
|
+
readonly indexed: true;
|
|
1124
|
+
}, {
|
|
1125
|
+
readonly type: "address";
|
|
1126
|
+
readonly name: "account";
|
|
1127
|
+
readonly indexed: true;
|
|
1128
|
+
}, {
|
|
1129
|
+
readonly type: "bool";
|
|
1130
|
+
readonly name: "allowed";
|
|
1131
|
+
}];
|
|
1132
|
+
}, {
|
|
1133
|
+
readonly name: "BlacklistUpdated";
|
|
1134
|
+
readonly type: "event";
|
|
1135
|
+
readonly inputs: readonly [{
|
|
1136
|
+
readonly type: "uint64";
|
|
1137
|
+
readonly name: "policyId";
|
|
1138
|
+
readonly indexed: true;
|
|
1139
|
+
}, {
|
|
1140
|
+
readonly type: "address";
|
|
1141
|
+
readonly name: "updater";
|
|
1142
|
+
readonly indexed: true;
|
|
1143
|
+
}, {
|
|
1144
|
+
readonly type: "address";
|
|
1145
|
+
readonly name: "account";
|
|
1146
|
+
readonly indexed: true;
|
|
1147
|
+
}, {
|
|
1148
|
+
readonly type: "bool";
|
|
1149
|
+
readonly name: "restricted";
|
|
1150
|
+
}];
|
|
1151
|
+
}, {
|
|
1152
|
+
readonly name: "CompoundPolicyCreated";
|
|
1153
|
+
readonly type: "event";
|
|
1154
|
+
readonly inputs: readonly [{
|
|
1155
|
+
readonly type: "uint64";
|
|
1156
|
+
readonly name: "policyId";
|
|
1157
|
+
readonly indexed: true;
|
|
1158
|
+
}, {
|
|
1159
|
+
readonly type: "address";
|
|
1160
|
+
readonly name: "creator";
|
|
1161
|
+
readonly indexed: true;
|
|
1162
|
+
}, {
|
|
1163
|
+
readonly type: "uint64";
|
|
1164
|
+
readonly name: "senderPolicyId";
|
|
1165
|
+
}, {
|
|
1166
|
+
readonly type: "uint64";
|
|
1167
|
+
readonly name: "recipientPolicyId";
|
|
1168
|
+
}, {
|
|
1169
|
+
readonly type: "uint64";
|
|
1170
|
+
readonly name: "mintRecipientPolicyId";
|
|
1171
|
+
}];
|
|
1172
|
+
}, {
|
|
1173
|
+
readonly name: "ReceivePolicyUpdated";
|
|
1174
|
+
readonly type: "event";
|
|
1175
|
+
readonly inputs: readonly [{
|
|
1176
|
+
readonly type: "address";
|
|
1177
|
+
readonly name: "account";
|
|
1178
|
+
readonly indexed: true;
|
|
1179
|
+
}, {
|
|
1180
|
+
readonly type: "uint64";
|
|
1181
|
+
readonly name: "senderPolicyId";
|
|
1182
|
+
}, {
|
|
1183
|
+
readonly type: "uint64";
|
|
1184
|
+
readonly name: "tokenFilterId";
|
|
1185
|
+
}, {
|
|
1186
|
+
readonly type: "address";
|
|
1187
|
+
readonly name: "recoveryAuthority";
|
|
1188
|
+
}];
|
|
1189
|
+
}, {
|
|
1190
|
+
readonly name: "Unauthorized";
|
|
1191
|
+
readonly type: "error";
|
|
1192
|
+
readonly inputs: readonly [];
|
|
1193
|
+
}, {
|
|
1194
|
+
readonly name: "PolicyNotFound";
|
|
1195
|
+
readonly type: "error";
|
|
1196
|
+
readonly inputs: readonly [];
|
|
1197
|
+
}, {
|
|
1198
|
+
readonly name: "PolicyNotSimple";
|
|
1199
|
+
readonly type: "error";
|
|
1200
|
+
readonly inputs: readonly [];
|
|
1201
|
+
}, {
|
|
1202
|
+
readonly name: "InvalidPolicyType";
|
|
1203
|
+
readonly type: "error";
|
|
1204
|
+
readonly inputs: readonly [];
|
|
1205
|
+
}, {
|
|
1206
|
+
readonly name: "IncompatiblePolicyType";
|
|
1207
|
+
readonly type: "error";
|
|
1208
|
+
readonly inputs: readonly [];
|
|
1209
|
+
}, {
|
|
1210
|
+
readonly name: "VirtualAddressNotAllowed";
|
|
1211
|
+
readonly type: "error";
|
|
1212
|
+
readonly inputs: readonly [];
|
|
1213
|
+
}, {
|
|
1214
|
+
readonly name: "InvalidReceivePolicyType";
|
|
1215
|
+
readonly type: "error";
|
|
1216
|
+
readonly inputs: readonly [];
|
|
1217
|
+
}, {
|
|
1218
|
+
readonly name: "InvalidRecoveryAuthority";
|
|
1219
|
+
readonly type: "error";
|
|
1220
|
+
readonly inputs: readonly [];
|
|
1221
|
+
}], "ReceivePolicyUpdated">;
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* Sets the receive policy for the calling account and waits for the receipt.
|
|
1225
|
+
*
|
|
1226
|
+
* @example
|
|
1227
|
+
* ```ts
|
|
1228
|
+
* import { createClient, http } from 'viem'
|
|
1229
|
+
* import { tempo } from 'viem/chains'
|
|
1230
|
+
* import { Actions } from 'viem/tempo'
|
|
1231
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
1232
|
+
*
|
|
1233
|
+
* const client = createClient({
|
|
1234
|
+
* account: privateKeyToAccount('0x...'),
|
|
1235
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
1236
|
+
* transport: http(),
|
|
1237
|
+
* })
|
|
1238
|
+
*
|
|
1239
|
+
* const { receipt, ...result } = await Actions.receivePolicy.setSync(client, {
|
|
1240
|
+
* senderPolicyId: 'allow-all',
|
|
1241
|
+
* tokenPolicyId: 'allow-all',
|
|
1242
|
+
* claimer: 'self',
|
|
1243
|
+
* })
|
|
1244
|
+
* ```
|
|
1245
|
+
*
|
|
1246
|
+
* @param client - Client.
|
|
1247
|
+
* @param parameters - Parameters.
|
|
1248
|
+
* @returns The transaction receipt and event data.
|
|
1249
|
+
*/
|
|
1250
|
+
export declare function setSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: setSync.Parameters<chain, account>): Promise<setSync.ReturnValue>;
|
|
1251
|
+
export declare namespace setSync {
|
|
1252
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = set.Parameters<chain, account>;
|
|
1253
|
+
type Args = set.Args;
|
|
1254
|
+
type ReturnValue = Compute<UnionOmit<GetEventArgs<typeof Abis.tip403Registry, 'ReceivePolicyUpdated', {
|
|
1255
|
+
IndexedOnly: false;
|
|
1256
|
+
Required: true;
|
|
1257
|
+
}>, 'senderPolicyId' | 'tokenFilterId'> & {
|
|
1258
|
+
/** TIP-403 policy restricting which senders are allowed. */
|
|
1259
|
+
senderPolicyId: PolicyRef;
|
|
1260
|
+
/** TIP-403 policy restricting which tokens are allowed. */
|
|
1261
|
+
tokenPolicyId: PolicyRef;
|
|
1262
|
+
/** Who can reclaim funds blocked by this policy. */
|
|
1263
|
+
claimer: Claimer;
|
|
1264
|
+
receipt: TransactionReceipt;
|
|
1265
|
+
}>;
|
|
1266
|
+
type ErrorType = BaseErrorType;
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Checks whether a transfer or mint to a receiver is allowed by the receiver's
|
|
1270
|
+
* receive policy.
|
|
1271
|
+
*
|
|
1272
|
+
* @example
|
|
1273
|
+
* ```ts
|
|
1274
|
+
* import { createClient, http } from 'viem'
|
|
1275
|
+
* import { tempo } from 'viem/chains'
|
|
1276
|
+
* import { Actions } from 'viem/tempo'
|
|
1277
|
+
*
|
|
1278
|
+
* const client = createClient({
|
|
1279
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
1280
|
+
* transport: http(),
|
|
1281
|
+
* })
|
|
1282
|
+
*
|
|
1283
|
+
* const { authorized, blockedReason } = await Actions.receivePolicy.validate(
|
|
1284
|
+
* client,
|
|
1285
|
+
* {
|
|
1286
|
+
* token: '0x...',
|
|
1287
|
+
* sender: '0x...',
|
|
1288
|
+
* receiver: '0x...',
|
|
1289
|
+
* },
|
|
1290
|
+
* )
|
|
1291
|
+
* ```
|
|
1292
|
+
*
|
|
1293
|
+
* @param client - Client.
|
|
1294
|
+
* @param parameters - Parameters.
|
|
1295
|
+
* @returns Whether the transfer is authorized and, if not, why.
|
|
1296
|
+
*/
|
|
1297
|
+
export declare function validate<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: validate.Parameters): Promise<validate.ReturnValue>;
|
|
1298
|
+
export declare namespace validate {
|
|
1299
|
+
type Parameters = ReadParameters & Args;
|
|
1300
|
+
type Args = {
|
|
1301
|
+
/** Token address. */
|
|
1302
|
+
token: Address;
|
|
1303
|
+
/** Sender address. */
|
|
1304
|
+
sender: Address;
|
|
1305
|
+
/** Receiver address. */
|
|
1306
|
+
receiver: Address;
|
|
1307
|
+
};
|
|
1308
|
+
type ReturnValue = Compute<{
|
|
1309
|
+
/** Whether the transfer is authorized. */
|
|
1310
|
+
authorized: boolean;
|
|
1311
|
+
/** Reason the transfer would be blocked. */
|
|
1312
|
+
blockedReason: BlockedReason;
|
|
1313
|
+
}>;
|
|
1314
|
+
/**
|
|
1315
|
+
* Defines a call to the `validateReceivePolicy` function.
|
|
1316
|
+
*
|
|
1317
|
+
* @param args - Arguments.
|
|
1318
|
+
* @returns The call.
|
|
1319
|
+
*/
|
|
1320
|
+
function call(args: Args): {
|
|
1321
|
+
abi: [{
|
|
1322
|
+
readonly name: "validateReceivePolicy";
|
|
1323
|
+
readonly type: "function";
|
|
1324
|
+
readonly stateMutability: "view";
|
|
1325
|
+
readonly inputs: readonly [{
|
|
1326
|
+
readonly type: "address";
|
|
1327
|
+
readonly name: "token";
|
|
1328
|
+
}, {
|
|
1329
|
+
readonly type: "address";
|
|
1330
|
+
readonly name: "sender";
|
|
1331
|
+
}, {
|
|
1332
|
+
readonly type: "address";
|
|
1333
|
+
readonly name: "receiver";
|
|
1334
|
+
}];
|
|
1335
|
+
readonly outputs: readonly [{
|
|
1336
|
+
readonly type: "bool";
|
|
1337
|
+
readonly name: "authorized";
|
|
1338
|
+
}, {
|
|
1339
|
+
readonly type: "uint8";
|
|
1340
|
+
readonly name: "blockedReason";
|
|
1341
|
+
}];
|
|
1342
|
+
}];
|
|
1343
|
+
functionName: "validateReceivePolicy";
|
|
1344
|
+
} & {
|
|
1345
|
+
args: readonly [token: `0x${string}`, sender: `0x${string}`, receiver: `0x${string}`];
|
|
1346
|
+
} & {
|
|
1347
|
+
address: Address;
|
|
1348
|
+
} & {
|
|
1349
|
+
data: Hex;
|
|
1350
|
+
to: Address;
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Watches for blocked transfer events.
|
|
1355
|
+
*
|
|
1356
|
+
* @example
|
|
1357
|
+
* ```ts
|
|
1358
|
+
* import { createClient, http } from 'viem'
|
|
1359
|
+
* import { tempo } from 'viem/chains'
|
|
1360
|
+
* import { Actions } from 'viem/tempo'
|
|
1361
|
+
*
|
|
1362
|
+
* const client = createClient({
|
|
1363
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
1364
|
+
* transport: http(),
|
|
1365
|
+
* })
|
|
1366
|
+
*
|
|
1367
|
+
* const unwatch = Actions.receivePolicy.watchBlocked(client, {
|
|
1368
|
+
* onBlocked: (args, log) => {
|
|
1369
|
+
* console.log('Transfer blocked:', args)
|
|
1370
|
+
* },
|
|
1371
|
+
* })
|
|
1372
|
+
* ```
|
|
1373
|
+
*
|
|
1374
|
+
* @param client - Client.
|
|
1375
|
+
* @param parameters - Parameters.
|
|
1376
|
+
* @returns A function to unsubscribe from the event.
|
|
1377
|
+
*/
|
|
1378
|
+
export declare function watchBlocked<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchBlocked.Parameters): import("../../actions/public/watchContractEvent.js").WatchContractEventReturnType;
|
|
1379
|
+
export declare namespace watchBlocked {
|
|
1380
|
+
type Args = Compute<UnionOmit<GetEventArgs<typeof Abis.receivePolicyGuard, 'TransferBlocked', {
|
|
1381
|
+
IndexedOnly: false;
|
|
1382
|
+
Required: true;
|
|
1383
|
+
}>, 'receipt'> & {
|
|
1384
|
+
/** The encoded claim receipt (witness for `claim`/`burn`). */
|
|
1385
|
+
claimReceipt: Hex;
|
|
1386
|
+
}>;
|
|
1387
|
+
type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.receivePolicyGuard, 'TransferBlocked'>, true>;
|
|
1388
|
+
type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.receivePolicyGuard, 'TransferBlocked', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
|
|
1389
|
+
/** Callback to invoke when a transfer is blocked. */
|
|
1390
|
+
onBlocked: (args: Args, log: Log) => void;
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Watches for receipt burned events.
|
|
1395
|
+
*
|
|
1396
|
+
* @example
|
|
1397
|
+
* ```ts
|
|
1398
|
+
* import { createClient, http } from 'viem'
|
|
1399
|
+
* import { tempo } from 'viem/chains'
|
|
1400
|
+
* import { Actions } from 'viem/tempo'
|
|
1401
|
+
*
|
|
1402
|
+
* const client = createClient({
|
|
1403
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
1404
|
+
* transport: http(),
|
|
1405
|
+
* })
|
|
1406
|
+
*
|
|
1407
|
+
* const unwatch = Actions.receivePolicy.watchBurned(client, {
|
|
1408
|
+
* onBurned: (args, log) => {
|
|
1409
|
+
* console.log('Receipt burned:', args)
|
|
1410
|
+
* },
|
|
1411
|
+
* })
|
|
1412
|
+
* ```
|
|
1413
|
+
*
|
|
1414
|
+
* @param client - Client.
|
|
1415
|
+
* @param parameters - Parameters.
|
|
1416
|
+
* @returns A function to unsubscribe from the event.
|
|
1417
|
+
*/
|
|
1418
|
+
export declare function watchBurned<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchBurned.Parameters): import("../../actions/public/watchContractEvent.js").WatchContractEventReturnType;
|
|
1419
|
+
export declare namespace watchBurned {
|
|
1420
|
+
type Args = Compute<GetEventArgs<typeof Abis.receivePolicyGuard, 'ReceiptBurned', {
|
|
1421
|
+
IndexedOnly: false;
|
|
1422
|
+
Required: true;
|
|
1423
|
+
}>>;
|
|
1424
|
+
type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.receivePolicyGuard, 'ReceiptBurned'>, true>;
|
|
1425
|
+
type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.receivePolicyGuard, 'ReceiptBurned', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
|
|
1426
|
+
/** Callback to invoke when a receipt is burned. */
|
|
1427
|
+
onBurned: (args: Args, log: Log) => void;
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Watches for receipt claimed events.
|
|
1432
|
+
*
|
|
1433
|
+
* @example
|
|
1434
|
+
* ```ts
|
|
1435
|
+
* import { createClient, http } from 'viem'
|
|
1436
|
+
* import { tempo } from 'viem/chains'
|
|
1437
|
+
* import { Actions } from 'viem/tempo'
|
|
1438
|
+
*
|
|
1439
|
+
* const client = createClient({
|
|
1440
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
1441
|
+
* transport: http(),
|
|
1442
|
+
* })
|
|
1443
|
+
*
|
|
1444
|
+
* const unwatch = Actions.receivePolicy.watchClaimed(client, {
|
|
1445
|
+
* onClaimed: (args, log) => {
|
|
1446
|
+
* console.log('Receipt claimed:', args)
|
|
1447
|
+
* },
|
|
1448
|
+
* })
|
|
1449
|
+
* ```
|
|
1450
|
+
*
|
|
1451
|
+
* @param client - Client.
|
|
1452
|
+
* @param parameters - Parameters.
|
|
1453
|
+
* @returns A function to unsubscribe from the event.
|
|
1454
|
+
*/
|
|
1455
|
+
export declare function watchClaimed<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchClaimed.Parameters): import("../../actions/public/watchContractEvent.js").WatchContractEventReturnType;
|
|
1456
|
+
export declare namespace watchClaimed {
|
|
1457
|
+
type Args = Compute<GetEventArgs<typeof Abis.receivePolicyGuard, 'ReceiptClaimed', {
|
|
1458
|
+
IndexedOnly: false;
|
|
1459
|
+
Required: true;
|
|
1460
|
+
}>>;
|
|
1461
|
+
type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.receivePolicyGuard, 'ReceiptClaimed'>, true>;
|
|
1462
|
+
type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.receivePolicyGuard, 'ReceiptClaimed', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
|
|
1463
|
+
/** Callback to invoke when a receipt is claimed. */
|
|
1464
|
+
onClaimed: (args: Args, log: Log) => void;
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
/**
|
|
1468
|
+
* Watches for receive policy update events.
|
|
1469
|
+
*
|
|
1470
|
+
* @example
|
|
1471
|
+
* ```ts
|
|
1472
|
+
* import { createClient, http } from 'viem'
|
|
1473
|
+
* import { tempo } from 'viem/chains'
|
|
1474
|
+
* import { Actions } from 'viem/tempo'
|
|
1475
|
+
*
|
|
1476
|
+
* const client = createClient({
|
|
1477
|
+
* chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
|
|
1478
|
+
* transport: http(),
|
|
1479
|
+
* })
|
|
1480
|
+
*
|
|
1481
|
+
* const unwatch = Actions.receivePolicy.watchUpdated(client, {
|
|
1482
|
+
* onUpdated: (args, log) => {
|
|
1483
|
+
* console.log('Receive policy updated:', args)
|
|
1484
|
+
* },
|
|
1485
|
+
* })
|
|
1486
|
+
* ```
|
|
1487
|
+
*
|
|
1488
|
+
* @param client - Client.
|
|
1489
|
+
* @param parameters - Parameters.
|
|
1490
|
+
* @returns A function to unsubscribe from the event.
|
|
1491
|
+
*/
|
|
1492
|
+
export declare function watchUpdated<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchUpdated.Parameters): import("../../actions/public/watchContractEvent.js").WatchContractEventReturnType;
|
|
1493
|
+
export declare namespace watchUpdated {
|
|
1494
|
+
type Args = Compute<UnionOmit<GetEventArgs<typeof Abis.tip403Registry, 'ReceivePolicyUpdated', {
|
|
1495
|
+
IndexedOnly: false;
|
|
1496
|
+
Required: true;
|
|
1497
|
+
}>, 'senderPolicyId' | 'tokenFilterId'> & {
|
|
1498
|
+
/** TIP-403 policy restricting which senders are allowed. */
|
|
1499
|
+
senderPolicyId: PolicyRef;
|
|
1500
|
+
/** TIP-403 policy restricting which tokens are allowed. */
|
|
1501
|
+
tokenPolicyId: PolicyRef;
|
|
1502
|
+
/** Who can reclaim funds blocked by this policy. */
|
|
1503
|
+
claimer: Claimer;
|
|
1504
|
+
}>;
|
|
1505
|
+
type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.tip403Registry, 'ReceivePolicyUpdated'>, true>;
|
|
1506
|
+
type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.tip403Registry, 'ReceivePolicyUpdated', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
|
|
1507
|
+
/** Callback to invoke when a receive policy is updated. */
|
|
1508
|
+
onUpdated: (args: Args, log: Log) => void;
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1511
|
+
//# sourceMappingURL=receivePolicy.d.ts.map
|