viem 2.43.4 → 2.44.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 +48 -0
- package/_cjs/account-abstraction/utils/userOperation/toPackedUserOperation.js +11 -1
- package/_cjs/account-abstraction/utils/userOperation/toPackedUserOperation.js.map +1 -1
- package/_cjs/actions/wallet/sendTransactionSync.js +1 -0
- package/_cjs/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_cjs/chains/definitions/codex.js +47 -0
- package/_cjs/chains/definitions/codex.js.map +1 -0
- package/_cjs/chains/definitions/codexTestnet.js +47 -0
- package/_cjs/chains/definitions/codexTestnet.js.map +1 -0
- package/_cjs/chains/definitions/paseoPassetHub.js +26 -0
- package/_cjs/chains/definitions/paseoPassetHub.js.map +1 -0
- package/_cjs/chains/definitions/{tempoTestnet.js → tempoAndantino.js} +5 -5
- package/_cjs/chains/definitions/tempoAndantino.js.map +1 -0
- package/_cjs/chains/definitions/tempoDevnet.js +7 -1
- package/_cjs/chains/definitions/tempoDevnet.js.map +1 -1
- package/_cjs/chains/definitions/tempoModerato.js +28 -0
- package/_cjs/chains/definitions/tempoModerato.js.map +1 -0
- package/_cjs/chains/index.js +23 -14
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/tempo/Abis.js +610 -752
- package/_cjs/tempo/Abis.js.map +1 -1
- package/_cjs/tempo/Addresses.js +2 -2
- package/_cjs/tempo/Addresses.js.map +1 -1
- package/_cjs/tempo/Decorator.js +5 -5
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/actions/amm.js +4 -38
- package/_cjs/tempo/actions/amm.js.map +1 -1
- package/_cjs/tempo/actions/dex.js +98 -46
- package/_cjs/tempo/actions/dex.js.map +1 -1
- package/_cjs/tempo/actions/nonce.js +0 -35
- package/_cjs/tempo/actions/nonce.js.map +1 -1
- package/_cjs/tempo/actions/reward.js +81 -62
- package/_cjs/tempo/actions/reward.js.map +1 -1
- package/_cjs/tempo/actions/token.js +11 -2
- package/_cjs/tempo/actions/token.js.map +1 -1
- package/_cjs/tempo/chainConfig.js +5 -10
- package/_cjs/tempo/chainConfig.js.map +1 -1
- package/_cjs/tempo/index.js +2 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_esm/account-abstraction/utils/userOperation/toPackedUserOperation.js +16 -2
- package/_esm/account-abstraction/utils/userOperation/toPackedUserOperation.js.map +1 -1
- package/_esm/actions/wallet/sendTransactionSync.js +1 -0
- package/_esm/actions/wallet/sendTransactionSync.js.map +1 -1
- package/_esm/chains/definitions/codex.js +44 -0
- package/_esm/chains/definitions/codex.js.map +1 -0
- package/_esm/chains/definitions/codexTestnet.js +44 -0
- package/_esm/chains/definitions/codexTestnet.js.map +1 -0
- package/_esm/chains/definitions/paseoPassetHub.js +23 -0
- package/_esm/chains/definitions/paseoPassetHub.js.map +1 -0
- package/_esm/chains/definitions/{tempoTestnet.js → tempoAndantino.js} +4 -4
- package/_esm/chains/definitions/tempoAndantino.js.map +1 -0
- package/_esm/chains/definitions/tempoDevnet.js +7 -1
- package/_esm/chains/definitions/tempoDevnet.js.map +1 -1
- package/_esm/chains/definitions/tempoModerato.js +25 -0
- package/_esm/chains/definitions/tempoModerato.js.map +1 -0
- package/_esm/chains/index.js +9 -1
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/tempo/Abis.js +609 -751
- package/_esm/tempo/Abis.js.map +1 -1
- package/_esm/tempo/Addresses.js +1 -1
- package/_esm/tempo/Addresses.js.map +1 -1
- package/_esm/tempo/Decorator.js +5 -5
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/actions/amm.js +4 -62
- package/_esm/tempo/actions/amm.js.map +1 -1
- package/_esm/tempo/actions/dex.js +192 -48
- package/_esm/tempo/actions/dex.js.map +1 -1
- package/_esm/tempo/actions/nonce.js +0 -94
- package/_esm/tempo/actions/nonce.js.map +1 -1
- package/_esm/tempo/actions/reward.js +227 -189
- package/_esm/tempo/actions/reward.js.map +1 -1
- package/_esm/tempo/actions/token.js +11 -2
- package/_esm/tempo/actions/token.js.map +1 -1
- package/_esm/tempo/chainConfig.js +2 -7
- package/_esm/tempo/chainConfig.js.map +1 -1
- package/_esm/tempo/index.js +1 -1
- package/_esm/tempo/index.js.map +1 -1
- package/_types/account-abstraction/utils/userOperation/toPackedUserOperation.d.ts.map +1 -1
- package/_types/actions/wallet/sendTransactionSync.d.ts.map +1 -1
- package/_types/celo/chainConfig.d.ts +22 -22
- package/_types/celo/formatters.d.ts +11 -11
- package/_types/chains/definitions/abstract.d.ts +14 -14
- package/_types/chains/definitions/abstractTestnet.d.ts +14 -14
- package/_types/chains/definitions/ancient8.d.ts +3 -3
- package/_types/chains/definitions/ancient8Sepolia.d.ts +3 -3
- package/_types/chains/definitions/base.d.ts +6 -6
- package/_types/chains/definitions/baseGoerli.d.ts +3 -3
- package/_types/chains/definitions/baseSepolia.d.ts +6 -6
- package/_types/chains/definitions/blast.d.ts +3 -3
- package/_types/chains/definitions/bob.d.ts +3 -3
- package/_types/chains/definitions/bobSepolia.d.ts +3 -3
- package/_types/chains/definitions/celo.d.ts +22 -22
- package/_types/chains/definitions/celoAlfajores.d.ts +22 -22
- package/_types/chains/definitions/celoSepolia.d.ts +22 -22
- package/_types/chains/definitions/codex.d.ts +310 -0
- package/_types/chains/definitions/codex.d.ts.map +1 -0
- package/_types/chains/definitions/codexTestnet.d.ts +310 -0
- package/_types/chains/definitions/codexTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/dchain.d.ts +3 -3
- package/_types/chains/definitions/dchainTestnet.d.ts +3 -3
- package/_types/chains/definitions/elysiumTestnet.d.ts +3 -3
- package/_types/chains/definitions/fraxtal.d.ts +3 -3
- package/_types/chains/definitions/fraxtalTestnet.d.ts +3 -3
- package/_types/chains/definitions/funkiMainnet.d.ts +3 -3
- package/_types/chains/definitions/funkiSepolia.d.ts +3 -3
- package/_types/chains/definitions/garnet.d.ts +3 -3
- package/_types/chains/definitions/giwaSepolia.d.ts +6 -6
- package/_types/chains/definitions/ink.d.ts +3 -3
- package/_types/chains/definitions/inkSepolia.d.ts +3 -3
- package/_types/chains/definitions/lisk.d.ts +3 -3
- package/_types/chains/definitions/liskSepolia.d.ts +3 -3
- package/_types/chains/definitions/metalL2.d.ts +3 -3
- package/_types/chains/definitions/mode.d.ts +3 -3
- package/_types/chains/definitions/modeTestnet.d.ts +3 -3
- package/_types/chains/definitions/optimism.d.ts +3 -3
- package/_types/chains/definitions/optimismGoerli.d.ts +3 -3
- package/_types/chains/definitions/optimismSepolia.d.ts +3 -3
- package/_types/chains/definitions/paseoPassetHub.d.ts +48 -0
- package/_types/chains/definitions/paseoPassetHub.d.ts.map +1 -0
- package/_types/chains/definitions/pgn.d.ts +3 -3
- package/_types/chains/definitions/pgnTestnet.d.ts +3 -3
- package/_types/chains/definitions/playfiAlbireo.d.ts +14 -14
- package/_types/chains/definitions/pyrope.d.ts +3 -3
- package/_types/chains/definitions/redstone.d.ts +3 -3
- package/_types/chains/definitions/rss3.d.ts +3 -3
- package/_types/chains/definitions/rss3Sepolia.d.ts +3 -3
- package/_types/chains/definitions/shape.d.ts +3 -3
- package/_types/chains/definitions/shapeSepolia.d.ts +3 -3
- package/_types/chains/definitions/snax.d.ts +3 -3
- package/_types/chains/definitions/snaxTestnet.d.ts +3 -3
- package/_types/chains/definitions/soneium.d.ts +3 -3
- package/_types/chains/definitions/soneiumMinato.d.ts +3 -3
- package/_types/chains/definitions/sophon.d.ts +14 -14
- package/_types/chains/definitions/sophonTestnet.d.ts +14 -14
- package/_types/chains/definitions/superseed.d.ts +3 -3
- package/_types/chains/definitions/superseedSepolia.d.ts +3 -3
- package/_types/chains/definitions/swellchain.d.ts +3 -3
- package/_types/chains/definitions/swellchainTestnet.d.ts +3 -3
- package/_types/chains/definitions/{tempoTestnet.d.ts → tempoAndantino.d.ts} +36 -40
- package/_types/chains/definitions/{tempoTestnet.d.ts.map → tempoAndantino.d.ts.map} +1 -1
- package/_types/chains/definitions/tempoDevnet.d.ts +43 -47
- package/_types/chains/definitions/tempoDevnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoLocalnet.d.ts +30 -34
- package/_types/chains/definitions/tempoLocalnet.d.ts.map +1 -1
- package/_types/chains/definitions/tempoModerato.d.ts +912 -0
- package/_types/chains/definitions/tempoModerato.d.ts.map +1 -0
- package/_types/chains/definitions/treasure.d.ts +14 -14
- package/_types/chains/definitions/treasureTopaz.d.ts +14 -14
- package/_types/chains/definitions/unichain.d.ts +3 -3
- package/_types/chains/definitions/unichainSepolia.d.ts +3 -3
- package/_types/chains/definitions/worldchain.d.ts +3 -3
- package/_types/chains/definitions/worldchainSepolia.d.ts +3 -3
- package/_types/chains/definitions/zircuit.d.ts +3 -3
- package/_types/chains/definitions/zircuitGarfieldTestnet.d.ts +3 -3
- package/_types/chains/definitions/zircuitTestnet.d.ts +3 -3
- package/_types/chains/definitions/zksync.d.ts +14 -14
- package/_types/chains/definitions/zksyncInMemoryNode.d.ts +14 -14
- package/_types/chains/definitions/zksyncLocalCustomHyperchain.d.ts +14 -14
- package/_types/chains/definitions/zksyncLocalHyperchain.d.ts +14 -14
- package/_types/chains/definitions/zksyncLocalNode.d.ts +14 -14
- package/_types/chains/definitions/zksyncSepoliaTestnet.d.ts +14 -14
- package/_types/chains/definitions/zora.d.ts +3 -3
- package/_types/chains/definitions/zoraSepolia.d.ts +3 -3
- package/_types/chains/definitions/zoraTestnet.d.ts +3 -3
- package/_types/chains/index.d.ts +9 -1
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +2 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/op-stack/chainConfig.d.ts +3 -3
- package/_types/op-stack/formatters.d.ts +3 -3
- package/_types/tempo/Abis.d.ts +937 -1194
- package/_types/tempo/Abis.d.ts.map +1 -1
- package/_types/tempo/Addresses.d.ts +1 -1
- package/_types/tempo/Addresses.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +91 -85
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/actions/amm.d.ts +19 -360
- package/_types/tempo/actions/amm.d.ts.map +1 -1
- package/_types/tempo/actions/dex.d.ts +765 -237
- package/_types/tempo/actions/dex.d.ts.map +1 -1
- package/_types/tempo/actions/fee.d.ts +30 -11
- package/_types/tempo/actions/fee.d.ts.map +1 -1
- package/_types/tempo/actions/nonce.d.ts +0 -105
- package/_types/tempo/actions/nonce.d.ts.map +1 -1
- package/_types/tempo/actions/policy.d.ts +60 -0
- package/_types/tempo/actions/policy.d.ts.map +1 -1
- package/_types/tempo/actions/reward.d.ts +350 -526
- package/_types/tempo/actions/reward.d.ts.map +1 -1
- package/_types/tempo/actions/token.d.ts +368 -1984
- package/_types/tempo/actions/token.d.ts.map +1 -1
- package/_types/tempo/chainConfig.d.ts +16 -19
- package/_types/tempo/chainConfig.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +1 -1
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/utils/formatters/transaction.d.ts +1 -1
- package/_types/utils/formatters/transactionRequest.d.ts +1 -1
- package/_types/zksync/chainConfig.d.ts +14 -14
- package/_types/zksync/formatters.d.ts +14 -14
- package/account-abstraction/utils/userOperation/toPackedUserOperation.ts +17 -2
- package/actions/wallet/sendTransactionSync.ts +1 -0
- package/chains/definitions/codex.ts +45 -0
- package/chains/definitions/codexTestnet.ts +45 -0
- package/chains/definitions/paseoPassetHub.ts +23 -0
- package/chains/definitions/{tempoTestnet.ts → tempoAndantino.ts} +3 -3
- package/chains/definitions/tempoDevnet.ts +7 -1
- package/chains/definitions/tempoModerato.ts +25 -0
- package/chains/index.ts +10 -1
- package/errors/version.ts +1 -1
- package/index.ts +9 -0
- package/package.json +2 -2
- package/tempo/Abis.ts +607 -752
- package/tempo/Addresses.ts +1 -1
- package/tempo/Decorator.ts +115 -106
- package/tempo/actions/amm.ts +13 -115
- package/tempo/actions/dex.ts +274 -72
- package/tempo/actions/nonce.ts +0 -148
- package/tempo/actions/reward.ts +310 -257
- package/tempo/actions/token.ts +16 -2
- package/tempo/chainConfig.ts +2 -9
- package/tempo/index.ts +1 -1
- package/_cjs/chains/definitions/tempoTestnet.js.map +0 -1
- package/_esm/chains/definitions/tempoTestnet.js.map +0 -1
|
@@ -162,156 +162,15 @@ export declare namespace claimSync {
|
|
|
162
162
|
type ErrorType = claim.ErrorType;
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
|
-
*
|
|
165
|
+
* Distributes rewards to opted-in token holders.
|
|
166
166
|
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
167
|
+
* This function transfers `amount` of tokens from the caller into the token contract's
|
|
168
|
+
* reward pool and immediately distributes them to current opted-in holders by increasing
|
|
169
|
+
* `globalRewardPerToken`.
|
|
170
170
|
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* import { tempo } from 'tempo.ts/chains'
|
|
175
|
-
* import { Actions } from 'tempo.ts/viem'
|
|
176
|
-
*
|
|
177
|
-
* const client = createClient({
|
|
178
|
-
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
179
|
-
* transport: http(),
|
|
180
|
-
* })
|
|
181
|
-
*
|
|
182
|
-
* const rate = await Actions.rewards.getTotalPerSecond(client, {
|
|
183
|
-
* token: '0x20c0000000000000000000000000000000000001',
|
|
184
|
-
* })
|
|
185
|
-
* ```
|
|
186
|
-
*
|
|
187
|
-
* @param client - Client.
|
|
188
|
-
* @param parameters - Parameters.
|
|
189
|
-
* @returns The total reward per second (scaled by 1e18).
|
|
190
|
-
*/
|
|
191
|
-
export declare function getTotalPerSecond<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: getTotalPerSecond.Parameters): Promise<getTotalPerSecond.ReturnValue>;
|
|
192
|
-
export declare namespace getTotalPerSecond {
|
|
193
|
-
type Parameters = ReadParameters & Args;
|
|
194
|
-
type Args = {
|
|
195
|
-
/** The TIP20 token address */
|
|
196
|
-
token: Address;
|
|
197
|
-
};
|
|
198
|
-
type ReturnValue = ReadContractReturnType<typeof Abis.tip20, 'totalRewardPerSecond', never>;
|
|
199
|
-
/**
|
|
200
|
-
* Defines a call to the `totalRewardPerSecond` function.
|
|
201
|
-
*
|
|
202
|
-
* @param args - Arguments.
|
|
203
|
-
* @returns The call.
|
|
204
|
-
*/
|
|
205
|
-
function call(args: Args): {
|
|
206
|
-
abi: [{
|
|
207
|
-
readonly name: "totalRewardPerSecond";
|
|
208
|
-
readonly type: "function";
|
|
209
|
-
readonly stateMutability: "view";
|
|
210
|
-
readonly inputs: readonly [];
|
|
211
|
-
readonly outputs: readonly [{
|
|
212
|
-
readonly type: "uint256";
|
|
213
|
-
}];
|
|
214
|
-
}];
|
|
215
|
-
functionName: "totalRewardPerSecond";
|
|
216
|
-
} & {
|
|
217
|
-
args?: readonly [] | undefined;
|
|
218
|
-
} & {
|
|
219
|
-
address: Address;
|
|
220
|
-
} & {
|
|
221
|
-
data: import("../../index.js").Hex;
|
|
222
|
-
to: Address;
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Gets the reward information for a specific account.
|
|
227
|
-
*
|
|
228
|
-
* Returns the reward recipient address, reward per token value, and accumulated reward balance for the specified account.
|
|
229
|
-
* This information includes:
|
|
230
|
-
* - `rewardRecipient`: The address designated to receive rewards (zero address if opted out)
|
|
231
|
-
* - `rewardPerToken`: The reward per token value for this account
|
|
232
|
-
* - `rewardBalance`: The accumulated reward balance waiting to be claimed
|
|
233
|
-
*
|
|
234
|
-
* @example
|
|
235
|
-
* ```ts
|
|
236
|
-
* import { createClient, http } from 'viem'
|
|
237
|
-
* import { tempo } from 'tempo.ts/chains'
|
|
238
|
-
* import { Actions } from 'tempo.ts/viem'
|
|
239
|
-
*
|
|
240
|
-
* const client = createClient({
|
|
241
|
-
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
242
|
-
* transport: http(),
|
|
243
|
-
* })
|
|
244
|
-
*
|
|
245
|
-
* const info = await Actions.reward.getUserRewardInfo(client, {
|
|
246
|
-
* token: '0x20c0000000000000000000000000000000000001',
|
|
247
|
-
* account: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
|
|
248
|
-
* })
|
|
249
|
-
* ```
|
|
250
|
-
*
|
|
251
|
-
* @param client - Client.
|
|
252
|
-
* @param parameters - Parameters.
|
|
253
|
-
* @returns The user's reward information (recipient, rewardPerToken, rewardBalance).
|
|
254
|
-
*/
|
|
255
|
-
export declare function getUserRewardInfo<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: getUserRewardInfo.Parameters): Promise<getUserRewardInfo.ReturnValue>;
|
|
256
|
-
export declare namespace getUserRewardInfo {
|
|
257
|
-
type Parameters = ReadParameters & Args;
|
|
258
|
-
type Args = {
|
|
259
|
-
/** The account address to query reward info for */
|
|
260
|
-
account: Address;
|
|
261
|
-
/** The TIP20 token address */
|
|
262
|
-
token: Address;
|
|
263
|
-
};
|
|
264
|
-
type ReturnValue = ReadContractReturnType<typeof Abis.tip20, 'userRewardInfo', never>;
|
|
265
|
-
/**
|
|
266
|
-
* Defines a call to the `userRewardInfo` function.
|
|
267
|
-
*
|
|
268
|
-
* @param args - Arguments.
|
|
269
|
-
* @returns The call.
|
|
270
|
-
*/
|
|
271
|
-
function call(args: Args): {
|
|
272
|
-
abi: [{
|
|
273
|
-
readonly name: "userRewardInfo";
|
|
274
|
-
readonly type: "function";
|
|
275
|
-
readonly stateMutability: "view";
|
|
276
|
-
readonly inputs: readonly [{
|
|
277
|
-
readonly type: "address";
|
|
278
|
-
readonly name: "account";
|
|
279
|
-
}];
|
|
280
|
-
readonly outputs: readonly [{
|
|
281
|
-
readonly type: "tuple";
|
|
282
|
-
readonly components: readonly [{
|
|
283
|
-
readonly type: "address";
|
|
284
|
-
readonly name: "rewardRecipient";
|
|
285
|
-
}, {
|
|
286
|
-
readonly type: "uint256";
|
|
287
|
-
readonly name: "rewardPerToken";
|
|
288
|
-
}, {
|
|
289
|
-
readonly type: "uint256";
|
|
290
|
-
readonly name: "rewardBalance";
|
|
291
|
-
}];
|
|
292
|
-
}];
|
|
293
|
-
}];
|
|
294
|
-
functionName: "userRewardInfo";
|
|
295
|
-
} & {
|
|
296
|
-
args: readonly [account: `0x${string}`];
|
|
297
|
-
} & {
|
|
298
|
-
address: Address;
|
|
299
|
-
} & {
|
|
300
|
-
data: import("../../index.js").Hex;
|
|
301
|
-
to: Address;
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Sets or changes the reward recipient for a token holder.
|
|
306
|
-
*
|
|
307
|
-
* This function allows a token holder to designate who should receive their share of rewards:
|
|
308
|
-
* - If `recipient` is the zero address, opts out from rewards distribution.
|
|
309
|
-
* - Otherwise, opts in and sets `recipient` as the address that will receive accrued rewards.
|
|
310
|
-
* - Can be called with `recipient == msg.sender` to receive rewards directly.
|
|
311
|
-
* - Automatically distributes any accrued rewards to the current recipient before changing.
|
|
312
|
-
*
|
|
313
|
-
* TIP-403 Policy:
|
|
314
|
-
* - Reverts with `PolicyForbids` if `recipient` is not the zero address and either the holder or recipient is not authorized to receive tokens under the token's transfer policy.
|
|
171
|
+
* Notes:
|
|
172
|
+
* - Reverts with `InvalidAmount` if `amount == 0`.
|
|
173
|
+
* - The transfer from caller to pool is subject to TIP-403 policy checks.
|
|
315
174
|
*
|
|
316
175
|
* @example
|
|
317
176
|
* ```ts
|
|
@@ -326,8 +185,8 @@ export declare namespace getUserRewardInfo {
|
|
|
326
185
|
* transport: http(),
|
|
327
186
|
* })
|
|
328
187
|
*
|
|
329
|
-
* const hash = await Actions.
|
|
330
|
-
*
|
|
188
|
+
* const hash = await Actions.reward.distribute(client, {
|
|
189
|
+
* amount: 100000000000000000000n,
|
|
331
190
|
* token: '0x20c0000000000000000000000000000000000001',
|
|
332
191
|
* })
|
|
333
192
|
* ```
|
|
@@ -336,18 +195,17 @@ export declare namespace getUserRewardInfo {
|
|
|
336
195
|
* @param parameters - Parameters.
|
|
337
196
|
* @returns The transaction hash.
|
|
338
197
|
*/
|
|
339
|
-
export declare function
|
|
198
|
+
export declare function distribute<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: distribute.Parameters<chain, account>): Promise<distribute.ReturnValue>;
|
|
340
199
|
/**
|
|
341
|
-
*
|
|
200
|
+
* Distributes rewards to opted-in token holders and waits for confirmation.
|
|
342
201
|
*
|
|
343
|
-
* This function
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
* - Can be called with `recipient == msg.sender` to receive rewards directly.
|
|
347
|
-
* - Automatically distributes any accrued rewards to the current recipient before changing.
|
|
202
|
+
* This function transfers `amount` of tokens from the caller into the token contract's
|
|
203
|
+
* reward pool and immediately distributes them to current opted-in holders by increasing
|
|
204
|
+
* `globalRewardPerToken`.
|
|
348
205
|
*
|
|
349
|
-
*
|
|
350
|
-
* - Reverts with `
|
|
206
|
+
* Notes:
|
|
207
|
+
* - Reverts with `InvalidAmount` if `amount == 0`.
|
|
208
|
+
* - The transfer from caller to pool is subject to TIP-403 policy checks.
|
|
351
209
|
*
|
|
352
210
|
* @example
|
|
353
211
|
* ```ts
|
|
@@ -362,21 +220,21 @@ export declare function setRecipient<chain extends Chain | undefined, account ex
|
|
|
362
220
|
* transport: http(),
|
|
363
221
|
* })
|
|
364
222
|
*
|
|
365
|
-
* const {
|
|
366
|
-
*
|
|
223
|
+
* const { amount, funder, receipt } = await Actions.reward.distributeSync(client, {
|
|
224
|
+
* amount: 100000000000000000000n,
|
|
367
225
|
* token: '0x20c0000000000000000000000000000000000001',
|
|
368
226
|
* })
|
|
369
227
|
* ```
|
|
370
228
|
*
|
|
371
229
|
* @param client - Client.
|
|
372
230
|
* @param parameters - Parameters.
|
|
373
|
-
* @returns The
|
|
231
|
+
* @returns The funder, amount, and transaction receipt.
|
|
374
232
|
*/
|
|
375
|
-
export declare function
|
|
376
|
-
export declare namespace
|
|
233
|
+
export declare function distributeSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: distributeSync.Parameters<chain, account>): Promise<distributeSync.ReturnValue>;
|
|
234
|
+
export declare namespace distribute {
|
|
377
235
|
type Args = {
|
|
378
|
-
/** The
|
|
379
|
-
|
|
236
|
+
/** The amount of tokens to distribute (must be > 0) */
|
|
237
|
+
amount: bigint;
|
|
380
238
|
/** The TIP20 token address */
|
|
381
239
|
token: Address;
|
|
382
240
|
};
|
|
@@ -386,7 +244,7 @@ export declare namespace setRecipient {
|
|
|
386
244
|
/** @internal */
|
|
387
245
|
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>>;
|
|
388
246
|
/**
|
|
389
|
-
* Defines a call to the `
|
|
247
|
+
* Defines a call to the `distributeReward` function.
|
|
390
248
|
*
|
|
391
249
|
* Can be passed as a parameter to:
|
|
392
250
|
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
@@ -405,8 +263,8 @@ export declare namespace setRecipient {
|
|
|
405
263
|
* }).extend(walletActions)
|
|
406
264
|
*
|
|
407
265
|
* const hash = await client.sendTransaction({
|
|
408
|
-
* calls: [actions.
|
|
409
|
-
*
|
|
266
|
+
* calls: [actions.reward.distribute.call({
|
|
267
|
+
* amount: 100000000000000000000n,
|
|
410
268
|
* token: '0x20c0000000000000000000000000000000000001',
|
|
411
269
|
* })],
|
|
412
270
|
* })
|
|
@@ -417,18 +275,18 @@ export declare namespace setRecipient {
|
|
|
417
275
|
*/
|
|
418
276
|
function call(args: Args): {
|
|
419
277
|
abi: [{
|
|
420
|
-
readonly name: "
|
|
278
|
+
readonly name: "distributeReward";
|
|
421
279
|
readonly type: "function";
|
|
422
280
|
readonly stateMutability: "nonpayable";
|
|
423
281
|
readonly inputs: readonly [{
|
|
424
|
-
readonly type: "
|
|
425
|
-
readonly name: "
|
|
282
|
+
readonly type: "uint256";
|
|
283
|
+
readonly name: "amount";
|
|
426
284
|
}];
|
|
427
285
|
readonly outputs: readonly [];
|
|
428
286
|
}];
|
|
429
|
-
functionName: "
|
|
287
|
+
functionName: "distributeReward";
|
|
430
288
|
} & {
|
|
431
|
-
args: readonly [
|
|
289
|
+
args: readonly [amount: bigint];
|
|
432
290
|
} & {
|
|
433
291
|
address: Address;
|
|
434
292
|
} & {
|
|
@@ -436,10 +294,10 @@ export declare namespace setRecipient {
|
|
|
436
294
|
to: Address;
|
|
437
295
|
};
|
|
438
296
|
/**
|
|
439
|
-
* Extracts the `
|
|
297
|
+
* Extracts the `RewardDistributed` event from logs.
|
|
440
298
|
*
|
|
441
299
|
* @param logs - The logs.
|
|
442
|
-
* @returns The `
|
|
300
|
+
* @returns The `RewardDistributed` event.
|
|
443
301
|
*/
|
|
444
302
|
function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
|
|
445
303
|
readonly name: "name";
|
|
@@ -686,25 +544,6 @@ export declare namespace setRecipient {
|
|
|
686
544
|
readonly outputs: readonly [{
|
|
687
545
|
readonly type: "bool";
|
|
688
546
|
}];
|
|
689
|
-
}, {
|
|
690
|
-
readonly name: "feeRecipient";
|
|
691
|
-
readonly type: "function";
|
|
692
|
-
readonly stateMutability: "view";
|
|
693
|
-
readonly inputs: readonly [];
|
|
694
|
-
readonly outputs: readonly [{
|
|
695
|
-
readonly type: "address";
|
|
696
|
-
}];
|
|
697
|
-
}, {
|
|
698
|
-
readonly name: "setFeeRecipient";
|
|
699
|
-
readonly type: "function";
|
|
700
|
-
readonly stateMutability: "view";
|
|
701
|
-
readonly inputs: readonly [{
|
|
702
|
-
readonly type: "address";
|
|
703
|
-
readonly name: "newRecipient";
|
|
704
|
-
}];
|
|
705
|
-
readonly outputs: readonly [{
|
|
706
|
-
readonly type: "address";
|
|
707
|
-
}];
|
|
708
547
|
}, {
|
|
709
548
|
readonly name: "changeTransferPolicyId";
|
|
710
549
|
readonly type: "function";
|
|
@@ -783,19 +622,14 @@ export declare namespace setRecipient {
|
|
|
783
622
|
readonly type: "bytes32";
|
|
784
623
|
}];
|
|
785
624
|
}, {
|
|
786
|
-
readonly name: "
|
|
625
|
+
readonly name: "distributeReward";
|
|
787
626
|
readonly type: "function";
|
|
788
627
|
readonly stateMutability: "nonpayable";
|
|
789
628
|
readonly inputs: readonly [{
|
|
790
629
|
readonly type: "uint256";
|
|
791
630
|
readonly name: "amount";
|
|
792
|
-
}, {
|
|
793
|
-
readonly type: "uint32";
|
|
794
|
-
readonly name: "secs";
|
|
795
|
-
}];
|
|
796
|
-
readonly outputs: readonly [{
|
|
797
|
-
readonly type: "uint64";
|
|
798
631
|
}];
|
|
632
|
+
readonly outputs: readonly [];
|
|
799
633
|
}, {
|
|
800
634
|
readonly name: "setRewardRecipient";
|
|
801
635
|
readonly type: "function";
|
|
@@ -805,17 +639,6 @@ export declare namespace setRecipient {
|
|
|
805
639
|
readonly name: "recipient";
|
|
806
640
|
}];
|
|
807
641
|
readonly outputs: readonly [];
|
|
808
|
-
}, {
|
|
809
|
-
readonly name: "cancelReward";
|
|
810
|
-
readonly type: "function";
|
|
811
|
-
readonly stateMutability: "nonpayable";
|
|
812
|
-
readonly inputs: readonly [{
|
|
813
|
-
readonly type: "uint64";
|
|
814
|
-
readonly name: "id";
|
|
815
|
-
}];
|
|
816
|
-
readonly outputs: readonly [{
|
|
817
|
-
readonly type: "uint256";
|
|
818
|
-
}];
|
|
819
642
|
}, {
|
|
820
643
|
readonly name: "claimRewards";
|
|
821
644
|
readonly type: "function";
|
|
@@ -824,50 +647,6 @@ export declare namespace setRecipient {
|
|
|
824
647
|
readonly outputs: readonly [{
|
|
825
648
|
readonly type: "uint256";
|
|
826
649
|
}];
|
|
827
|
-
}, {
|
|
828
|
-
readonly name: "finalizeStreams";
|
|
829
|
-
readonly type: "function";
|
|
830
|
-
readonly stateMutability: "nonpayable";
|
|
831
|
-
readonly inputs: readonly [{
|
|
832
|
-
readonly type: "uint64";
|
|
833
|
-
readonly name: "timestamp";
|
|
834
|
-
}];
|
|
835
|
-
readonly outputs: readonly [];
|
|
836
|
-
}, {
|
|
837
|
-
readonly name: "getStream";
|
|
838
|
-
readonly type: "function";
|
|
839
|
-
readonly stateMutability: "view";
|
|
840
|
-
readonly inputs: readonly [{
|
|
841
|
-
readonly type: "uint64";
|
|
842
|
-
readonly name: "id";
|
|
843
|
-
}];
|
|
844
|
-
readonly outputs: readonly [{
|
|
845
|
-
readonly type: "tuple";
|
|
846
|
-
readonly components: readonly [{
|
|
847
|
-
readonly type: "address";
|
|
848
|
-
readonly name: "funder";
|
|
849
|
-
}, {
|
|
850
|
-
readonly type: "uint64";
|
|
851
|
-
readonly name: "startTime";
|
|
852
|
-
}, {
|
|
853
|
-
readonly type: "uint64";
|
|
854
|
-
readonly name: "endTime";
|
|
855
|
-
}, {
|
|
856
|
-
readonly type: "uint256";
|
|
857
|
-
readonly name: "ratePerSecondScaled";
|
|
858
|
-
}, {
|
|
859
|
-
readonly type: "uint256";
|
|
860
|
-
readonly name: "amountTotal";
|
|
861
|
-
}];
|
|
862
|
-
}];
|
|
863
|
-
}, {
|
|
864
|
-
readonly name: "totalRewardPerSecond";
|
|
865
|
-
readonly type: "function";
|
|
866
|
-
readonly stateMutability: "view";
|
|
867
|
-
readonly inputs: readonly [];
|
|
868
|
-
readonly outputs: readonly [{
|
|
869
|
-
readonly type: "uint256";
|
|
870
|
-
}];
|
|
871
650
|
}, {
|
|
872
651
|
readonly name: "optedInSupply";
|
|
873
652
|
readonly type: "function";
|
|
@@ -877,12 +656,12 @@ export declare namespace setRecipient {
|
|
|
877
656
|
readonly type: "uint128";
|
|
878
657
|
}];
|
|
879
658
|
}, {
|
|
880
|
-
readonly name: "
|
|
659
|
+
readonly name: "globalRewardPerToken";
|
|
881
660
|
readonly type: "function";
|
|
882
661
|
readonly stateMutability: "view";
|
|
883
662
|
readonly inputs: readonly [];
|
|
884
663
|
readonly outputs: readonly [{
|
|
885
|
-
readonly type: "
|
|
664
|
+
readonly type: "uint256";
|
|
886
665
|
}];
|
|
887
666
|
}, {
|
|
888
667
|
readonly name: "userRewardInfo";
|
|
@@ -905,6 +684,17 @@ export declare namespace setRecipient {
|
|
|
905
684
|
readonly name: "rewardBalance";
|
|
906
685
|
}];
|
|
907
686
|
}];
|
|
687
|
+
}, {
|
|
688
|
+
readonly name: "getPendingRewards";
|
|
689
|
+
readonly type: "function";
|
|
690
|
+
readonly stateMutability: "view";
|
|
691
|
+
readonly inputs: readonly [{
|
|
692
|
+
readonly type: "address";
|
|
693
|
+
readonly name: "account";
|
|
694
|
+
}];
|
|
695
|
+
readonly outputs: readonly [{
|
|
696
|
+
readonly type: "uint128";
|
|
697
|
+
}];
|
|
908
698
|
}, {
|
|
909
699
|
readonly name: "Transfer";
|
|
910
700
|
readonly type: "event";
|
|
@@ -1047,37 +837,15 @@ export declare namespace setRecipient {
|
|
|
1047
837
|
readonly indexed: true;
|
|
1048
838
|
}];
|
|
1049
839
|
}, {
|
|
1050
|
-
readonly name: "
|
|
840
|
+
readonly name: "RewardDistributed";
|
|
1051
841
|
readonly type: "event";
|
|
1052
842
|
readonly inputs: readonly [{
|
|
1053
843
|
readonly type: "address";
|
|
1054
844
|
readonly name: "funder";
|
|
1055
845
|
readonly indexed: true;
|
|
1056
|
-
}, {
|
|
1057
|
-
readonly type: "uint64";
|
|
1058
|
-
readonly name: "id";
|
|
1059
|
-
readonly indexed: true;
|
|
1060
846
|
}, {
|
|
1061
847
|
readonly type: "uint256";
|
|
1062
848
|
readonly name: "amount";
|
|
1063
|
-
}, {
|
|
1064
|
-
readonly type: "uint32";
|
|
1065
|
-
readonly name: "durationSeconds";
|
|
1066
|
-
}];
|
|
1067
|
-
}, {
|
|
1068
|
-
readonly name: "RewardCanceled";
|
|
1069
|
-
readonly type: "event";
|
|
1070
|
-
readonly inputs: readonly [{
|
|
1071
|
-
readonly type: "address";
|
|
1072
|
-
readonly name: "funder";
|
|
1073
|
-
readonly indexed: true;
|
|
1074
|
-
}, {
|
|
1075
|
-
readonly type: "uint64";
|
|
1076
|
-
readonly name: "id";
|
|
1077
|
-
readonly indexed: true;
|
|
1078
|
-
}, {
|
|
1079
|
-
readonly type: "uint256";
|
|
1080
|
-
readonly name: "refund";
|
|
1081
849
|
}];
|
|
1082
850
|
}, {
|
|
1083
851
|
readonly name: "RewardRecipientSet";
|
|
@@ -1091,18 +859,6 @@ export declare namespace setRecipient {
|
|
|
1091
859
|
readonly name: "recipient";
|
|
1092
860
|
readonly indexed: true;
|
|
1093
861
|
}];
|
|
1094
|
-
}, {
|
|
1095
|
-
readonly name: "FeeRecipientUpdated";
|
|
1096
|
-
readonly type: "event";
|
|
1097
|
-
readonly inputs: readonly [{
|
|
1098
|
-
readonly type: "address";
|
|
1099
|
-
readonly name: "updater";
|
|
1100
|
-
readonly indexed: true;
|
|
1101
|
-
}, {
|
|
1102
|
-
readonly type: "address";
|
|
1103
|
-
readonly name: "newRecipient";
|
|
1104
|
-
readonly indexed: true;
|
|
1105
|
-
}];
|
|
1106
862
|
}, {
|
|
1107
863
|
readonly name: "InsufficientBalance";
|
|
1108
864
|
readonly type: "error";
|
|
@@ -1164,14 +920,6 @@ export declare namespace setRecipient {
|
|
|
1164
920
|
readonly name: "InvalidAmount";
|
|
1165
921
|
readonly type: "error";
|
|
1166
922
|
readonly inputs: readonly [];
|
|
1167
|
-
}, {
|
|
1168
|
-
readonly name: "NotStreamFunder";
|
|
1169
|
-
readonly type: "error";
|
|
1170
|
-
readonly inputs: readonly [];
|
|
1171
|
-
}, {
|
|
1172
|
-
readonly name: "StreamInactive";
|
|
1173
|
-
readonly type: "error";
|
|
1174
|
-
readonly inputs: readonly [];
|
|
1175
923
|
}, {
|
|
1176
924
|
readonly name: "NoOptedInSupply";
|
|
1177
925
|
readonly type: "error";
|
|
@@ -1181,19 +929,19 @@ export declare namespace setRecipient {
|
|
|
1181
929
|
readonly type: "error";
|
|
1182
930
|
readonly inputs: readonly [];
|
|
1183
931
|
}, {
|
|
1184
|
-
readonly name: "
|
|
932
|
+
readonly name: "ProtectedAddress";
|
|
1185
933
|
readonly type: "error";
|
|
1186
934
|
readonly inputs: readonly [];
|
|
1187
935
|
}, {
|
|
1188
|
-
readonly name: "
|
|
936
|
+
readonly name: "InvalidToken";
|
|
1189
937
|
readonly type: "error";
|
|
1190
938
|
readonly inputs: readonly [];
|
|
1191
939
|
}, {
|
|
1192
|
-
readonly name: "
|
|
940
|
+
readonly name: "Uninitialized";
|
|
1193
941
|
readonly type: "error";
|
|
1194
942
|
readonly inputs: readonly [];
|
|
1195
943
|
}, {
|
|
1196
|
-
readonly name: "
|
|
944
|
+
readonly name: "InvalidTransferPolicyId";
|
|
1197
945
|
readonly type: "error";
|
|
1198
946
|
readonly inputs: readonly [];
|
|
1199
947
|
}, {
|
|
@@ -1301,38 +1049,239 @@ export declare namespace setRecipient {
|
|
|
1301
1049
|
readonly name: "sender";
|
|
1302
1050
|
readonly indexed: true;
|
|
1303
1051
|
}];
|
|
1304
|
-
}, {
|
|
1305
|
-
readonly name: "Unauthorized";
|
|
1306
|
-
readonly type: "error";
|
|
1307
|
-
readonly inputs: readonly [];
|
|
1308
|
-
}], "
|
|
1309
|
-
}
|
|
1310
|
-
export declare namespace
|
|
1311
|
-
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> &
|
|
1312
|
-
type ReturnValue = {
|
|
1313
|
-
/** The
|
|
1314
|
-
|
|
1315
|
-
/** The
|
|
1316
|
-
|
|
1317
|
-
/** The
|
|
1318
|
-
|
|
1052
|
+
}, {
|
|
1053
|
+
readonly name: "Unauthorized";
|
|
1054
|
+
readonly type: "error";
|
|
1055
|
+
readonly inputs: readonly [];
|
|
1056
|
+
}], "RewardDistributed">;
|
|
1057
|
+
}
|
|
1058
|
+
export declare namespace distributeSync {
|
|
1059
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & distribute.Args;
|
|
1060
|
+
type ReturnValue = {
|
|
1061
|
+
/** The amount distributed */
|
|
1062
|
+
amount: bigint;
|
|
1063
|
+
/** The address that funded the distribution */
|
|
1064
|
+
funder: Address;
|
|
1065
|
+
/** The transaction receipt */
|
|
1066
|
+
receipt: Awaited<ReturnType<typeof writeContractSync>>;
|
|
1067
|
+
};
|
|
1068
|
+
type ErrorType = distribute.ErrorType;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Gets the global reward per token value.
|
|
1072
|
+
*
|
|
1073
|
+
* Returns the current global reward per token value scaled by `ACC_PRECISION` (1e18).
|
|
1074
|
+
* This value increases each time rewards are distributed.
|
|
1075
|
+
*
|
|
1076
|
+
* @example
|
|
1077
|
+
* ```ts
|
|
1078
|
+
* import { createClient, http } from 'viem'
|
|
1079
|
+
* import { tempo } from 'tempo.ts/chains'
|
|
1080
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1081
|
+
*
|
|
1082
|
+
* const client = createClient({
|
|
1083
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1084
|
+
* transport: http(),
|
|
1085
|
+
* })
|
|
1086
|
+
*
|
|
1087
|
+
* const rewardPerToken = await Actions.reward.getGlobalRewardPerToken(client, {
|
|
1088
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
1089
|
+
* })
|
|
1090
|
+
* ```
|
|
1091
|
+
*
|
|
1092
|
+
* @param client - Client.
|
|
1093
|
+
* @param parameters - Parameters.
|
|
1094
|
+
* @returns The global reward per token (scaled by 1e18).
|
|
1095
|
+
*/
|
|
1096
|
+
export declare function getGlobalRewardPerToken<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: getGlobalRewardPerToken.Parameters): Promise<getGlobalRewardPerToken.ReturnValue>;
|
|
1097
|
+
export declare namespace getGlobalRewardPerToken {
|
|
1098
|
+
type Parameters = ReadParameters & Args;
|
|
1099
|
+
type Args = {
|
|
1100
|
+
/** The TIP20 token address */
|
|
1101
|
+
token: Address;
|
|
1102
|
+
};
|
|
1103
|
+
type ReturnValue = ReadContractReturnType<typeof Abis.tip20, 'globalRewardPerToken', never>;
|
|
1104
|
+
/**
|
|
1105
|
+
* Defines a call to the `globalRewardPerToken` function.
|
|
1106
|
+
*
|
|
1107
|
+
* @param args - Arguments.
|
|
1108
|
+
* @returns The call.
|
|
1109
|
+
*/
|
|
1110
|
+
function call(args: Args): {
|
|
1111
|
+
abi: [{
|
|
1112
|
+
readonly name: "globalRewardPerToken";
|
|
1113
|
+
readonly type: "function";
|
|
1114
|
+
readonly stateMutability: "view";
|
|
1115
|
+
readonly inputs: readonly [];
|
|
1116
|
+
readonly outputs: readonly [{
|
|
1117
|
+
readonly type: "uint256";
|
|
1118
|
+
}];
|
|
1119
|
+
}];
|
|
1120
|
+
functionName: "globalRewardPerToken";
|
|
1121
|
+
} & {
|
|
1122
|
+
args?: readonly [] | undefined;
|
|
1123
|
+
} & {
|
|
1124
|
+
address: Address;
|
|
1125
|
+
} & {
|
|
1126
|
+
data: import("../../index.js").Hex;
|
|
1127
|
+
to: Address;
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Calculates the pending claimable rewards for an account without modifying state.
|
|
1132
|
+
*
|
|
1133
|
+
* Returns the total pending claimable reward amount, including stored balance and newly accrued rewards.
|
|
1134
|
+
*
|
|
1135
|
+
* @example
|
|
1136
|
+
* ```ts
|
|
1137
|
+
* import { createClient, http } from 'viem'
|
|
1138
|
+
* import { tempo } from 'tempo.ts/chains'
|
|
1139
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1140
|
+
*
|
|
1141
|
+
* const client = createClient({
|
|
1142
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1143
|
+
* transport: http(),
|
|
1144
|
+
* })
|
|
1145
|
+
*
|
|
1146
|
+
* const pending = await Actions.reward.getPendingRewards(client, {
|
|
1147
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
1148
|
+
* account: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
|
|
1149
|
+
* })
|
|
1150
|
+
* ```
|
|
1151
|
+
*
|
|
1152
|
+
* @param client - Client.
|
|
1153
|
+
* @param parameters - Parameters.
|
|
1154
|
+
* @returns The total pending claimable reward amount.
|
|
1155
|
+
*/
|
|
1156
|
+
export declare function getPendingRewards<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: getPendingRewards.Parameters): Promise<getPendingRewards.ReturnValue>;
|
|
1157
|
+
export declare namespace getPendingRewards {
|
|
1158
|
+
type Parameters = ReadParameters & Args;
|
|
1159
|
+
type Args = {
|
|
1160
|
+
/** The account address to query pending rewards for */
|
|
1161
|
+
account: Address;
|
|
1162
|
+
/** The TIP20 token address */
|
|
1163
|
+
token: Address;
|
|
1164
|
+
};
|
|
1165
|
+
type ReturnValue = ReadContractReturnType<typeof Abis.tip20, 'getPendingRewards', never>;
|
|
1166
|
+
/**
|
|
1167
|
+
* Defines a call to the `getPendingRewards` function.
|
|
1168
|
+
*
|
|
1169
|
+
* @param args - Arguments.
|
|
1170
|
+
* @returns The call.
|
|
1171
|
+
*/
|
|
1172
|
+
function call(args: Args): {
|
|
1173
|
+
abi: [{
|
|
1174
|
+
readonly name: "getPendingRewards";
|
|
1175
|
+
readonly type: "function";
|
|
1176
|
+
readonly stateMutability: "view";
|
|
1177
|
+
readonly inputs: readonly [{
|
|
1178
|
+
readonly type: "address";
|
|
1179
|
+
readonly name: "account";
|
|
1180
|
+
}];
|
|
1181
|
+
readonly outputs: readonly [{
|
|
1182
|
+
readonly type: "uint128";
|
|
1183
|
+
}];
|
|
1184
|
+
}];
|
|
1185
|
+
functionName: "getPendingRewards";
|
|
1186
|
+
} & {
|
|
1187
|
+
args: readonly [account: `0x${string}`];
|
|
1188
|
+
} & {
|
|
1189
|
+
address: Address;
|
|
1190
|
+
} & {
|
|
1191
|
+
data: import("../../index.js").Hex;
|
|
1192
|
+
to: Address;
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Gets the reward information for a specific account.
|
|
1197
|
+
*
|
|
1198
|
+
* Returns the reward recipient address, reward per token value, and accumulated reward balance for the specified account.
|
|
1199
|
+
* This information includes:
|
|
1200
|
+
* - `rewardRecipient`: The address designated to receive rewards (zero address if opted out)
|
|
1201
|
+
* - `rewardPerToken`: The reward per token value for this account
|
|
1202
|
+
* - `rewardBalance`: The accumulated reward balance waiting to be claimed
|
|
1203
|
+
*
|
|
1204
|
+
* @example
|
|
1205
|
+
* ```ts
|
|
1206
|
+
* import { createClient, http } from 'viem'
|
|
1207
|
+
* import { tempo } from 'tempo.ts/chains'
|
|
1208
|
+
* import { Actions } from 'tempo.ts/viem'
|
|
1209
|
+
*
|
|
1210
|
+
* const client = createClient({
|
|
1211
|
+
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' })
|
|
1212
|
+
* transport: http(),
|
|
1213
|
+
* })
|
|
1214
|
+
*
|
|
1215
|
+
* const info = await Actions.reward.getUserRewardInfo(client, {
|
|
1216
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
1217
|
+
* account: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
|
|
1218
|
+
* })
|
|
1219
|
+
* ```
|
|
1220
|
+
*
|
|
1221
|
+
* @param client - Client.
|
|
1222
|
+
* @param parameters - Parameters.
|
|
1223
|
+
* @returns The user's reward information (recipient, rewardPerToken, rewardBalance).
|
|
1224
|
+
*/
|
|
1225
|
+
export declare function getUserRewardInfo<chain extends Chain | undefined>(client: Client<Transport, chain>, parameters: getUserRewardInfo.Parameters): Promise<getUserRewardInfo.ReturnValue>;
|
|
1226
|
+
export declare namespace getUserRewardInfo {
|
|
1227
|
+
type Parameters = ReadParameters & Args;
|
|
1228
|
+
type Args = {
|
|
1229
|
+
/** The account address to query reward info for */
|
|
1230
|
+
account: Address;
|
|
1231
|
+
/** The TIP20 token address */
|
|
1232
|
+
token: Address;
|
|
1233
|
+
};
|
|
1234
|
+
type ReturnValue = ReadContractReturnType<typeof Abis.tip20, 'userRewardInfo', never>;
|
|
1235
|
+
/**
|
|
1236
|
+
* Defines a call to the `userRewardInfo` function.
|
|
1237
|
+
*
|
|
1238
|
+
* @param args - Arguments.
|
|
1239
|
+
* @returns The call.
|
|
1240
|
+
*/
|
|
1241
|
+
function call(args: Args): {
|
|
1242
|
+
abi: [{
|
|
1243
|
+
readonly name: "userRewardInfo";
|
|
1244
|
+
readonly type: "function";
|
|
1245
|
+
readonly stateMutability: "view";
|
|
1246
|
+
readonly inputs: readonly [{
|
|
1247
|
+
readonly type: "address";
|
|
1248
|
+
readonly name: "account";
|
|
1249
|
+
}];
|
|
1250
|
+
readonly outputs: readonly [{
|
|
1251
|
+
readonly type: "tuple";
|
|
1252
|
+
readonly components: readonly [{
|
|
1253
|
+
readonly type: "address";
|
|
1254
|
+
readonly name: "rewardRecipient";
|
|
1255
|
+
}, {
|
|
1256
|
+
readonly type: "uint256";
|
|
1257
|
+
readonly name: "rewardPerToken";
|
|
1258
|
+
}, {
|
|
1259
|
+
readonly type: "uint256";
|
|
1260
|
+
readonly name: "rewardBalance";
|
|
1261
|
+
}];
|
|
1262
|
+
}];
|
|
1263
|
+
}];
|
|
1264
|
+
functionName: "userRewardInfo";
|
|
1265
|
+
} & {
|
|
1266
|
+
args: readonly [account: `0x${string}`];
|
|
1267
|
+
} & {
|
|
1268
|
+
address: Address;
|
|
1269
|
+
} & {
|
|
1270
|
+
data: import("../../index.js").Hex;
|
|
1271
|
+
to: Address;
|
|
1319
1272
|
};
|
|
1320
|
-
type ErrorType = setRecipient.ErrorType;
|
|
1321
1273
|
}
|
|
1322
1274
|
/**
|
|
1323
|
-
*
|
|
1275
|
+
* Sets or changes the reward recipient for a token holder.
|
|
1324
1276
|
*
|
|
1325
|
-
*
|
|
1326
|
-
* -
|
|
1327
|
-
* -
|
|
1328
|
-
*
|
|
1329
|
-
* -
|
|
1330
|
-
* Returns a unique stream ID for later cancellation.
|
|
1277
|
+
* This function allows a token holder to designate who should receive their share of rewards:
|
|
1278
|
+
* - If `recipient` is the zero address, opts out from rewards distribution.
|
|
1279
|
+
* - Otherwise, opts in and sets `recipient` as the address that will receive accrued rewards.
|
|
1280
|
+
* - Can be called with `recipient == msg.sender` to receive rewards directly.
|
|
1281
|
+
* - Automatically distributes any accrued rewards to the current recipient before changing.
|
|
1331
1282
|
*
|
|
1332
|
-
*
|
|
1333
|
-
* - Reverts with `
|
|
1334
|
-
* - Allowed even when `optedInSupply == 0` (tokens distributed while no one is opted in are locked permanently).
|
|
1335
|
-
* - The transfer from caller to pool is subject to TIP-403 policy checks.
|
|
1283
|
+
* TIP-403 Policy:
|
|
1284
|
+
* - Reverts with `PolicyForbids` if `recipient` is not the zero address and either the holder or recipient is not authorized to receive tokens under the token's transfer policy.
|
|
1336
1285
|
*
|
|
1337
1286
|
* @example
|
|
1338
1287
|
* ```ts
|
|
@@ -1347,9 +1296,8 @@ export declare namespace setRecipientSync {
|
|
|
1347
1296
|
* transport: http(),
|
|
1348
1297
|
* })
|
|
1349
1298
|
*
|
|
1350
|
-
* const hash = await Actions.
|
|
1351
|
-
*
|
|
1352
|
-
* seconds: 86400,
|
|
1299
|
+
* const hash = await Actions.reward.setRecipient(client, {
|
|
1300
|
+
* recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
|
|
1353
1301
|
* token: '0x20c0000000000000000000000000000000000001',
|
|
1354
1302
|
* })
|
|
1355
1303
|
* ```
|
|
@@ -1358,21 +1306,18 @@ export declare namespace setRecipientSync {
|
|
|
1358
1306
|
* @param parameters - Parameters.
|
|
1359
1307
|
* @returns The transaction hash.
|
|
1360
1308
|
*/
|
|
1361
|
-
export declare function
|
|
1309
|
+
export declare function setRecipient<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: setRecipient.Parameters<chain, account>): Promise<setRecipient.ReturnValue>;
|
|
1362
1310
|
/**
|
|
1363
|
-
*
|
|
1311
|
+
* Sets or changes the reward recipient for a token holder and waits for confirmation.
|
|
1364
1312
|
*
|
|
1365
|
-
*
|
|
1366
|
-
* -
|
|
1367
|
-
* -
|
|
1368
|
-
*
|
|
1369
|
-
* -
|
|
1370
|
-
* Returns a unique stream ID for later cancellation.
|
|
1313
|
+
* This function allows a token holder to designate who should receive their share of rewards:
|
|
1314
|
+
* - If `recipient` is the zero address, opts out from rewards distribution.
|
|
1315
|
+
* - Otherwise, opts in and sets `recipient` as the address that will receive accrued rewards.
|
|
1316
|
+
* - Can be called with `recipient == msg.sender` to receive rewards directly.
|
|
1317
|
+
* - Automatically distributes any accrued rewards to the current recipient before changing.
|
|
1371
1318
|
*
|
|
1372
|
-
*
|
|
1373
|
-
* - Reverts with `
|
|
1374
|
-
* - Allowed even when `optedInSupply == 0` (tokens distributed while no one is opted in are locked permanently).
|
|
1375
|
-
* - The transfer from caller to pool is subject to TIP-403 policy checks.
|
|
1319
|
+
* TIP-403 Policy:
|
|
1320
|
+
* - Reverts with `PolicyForbids` if `recipient` is not the zero address and either the holder or recipient is not authorized to receive tokens under the token's transfer policy.
|
|
1376
1321
|
*
|
|
1377
1322
|
* @example
|
|
1378
1323
|
* ```ts
|
|
@@ -1387,22 +1332,21 @@ export declare function start<chain extends Chain | undefined, account extends A
|
|
|
1387
1332
|
* transport: http(),
|
|
1388
1333
|
* })
|
|
1389
1334
|
*
|
|
1390
|
-
* const {
|
|
1391
|
-
*
|
|
1392
|
-
* seconds: 86400,
|
|
1335
|
+
* const { holder, recipient, receipt } = await Actions.reward.setRecipientSync(client, {
|
|
1336
|
+
* recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
|
|
1393
1337
|
* token: '0x20c0000000000000000000000000000000000001',
|
|
1394
1338
|
* })
|
|
1395
1339
|
* ```
|
|
1396
1340
|
*
|
|
1397
1341
|
* @param client - Client.
|
|
1398
1342
|
* @param parameters - Parameters.
|
|
1399
|
-
* @returns The
|
|
1343
|
+
* @returns The holder, recipient, and transaction receipt.
|
|
1400
1344
|
*/
|
|
1401
|
-
export declare function
|
|
1402
|
-
export declare namespace
|
|
1345
|
+
export declare function setRecipientSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: setRecipientSync.Parameters<chain, account>): Promise<setRecipientSync.ReturnValue>;
|
|
1346
|
+
export declare namespace setRecipient {
|
|
1403
1347
|
type Args = {
|
|
1404
|
-
/** The
|
|
1405
|
-
|
|
1348
|
+
/** The reward recipient address (use zero address to opt out of rewards) */
|
|
1349
|
+
recipient: Address;
|
|
1406
1350
|
/** The TIP20 token address */
|
|
1407
1351
|
token: Address;
|
|
1408
1352
|
};
|
|
@@ -1412,7 +1356,7 @@ export declare namespace start {
|
|
|
1412
1356
|
/** @internal */
|
|
1413
1357
|
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>>;
|
|
1414
1358
|
/**
|
|
1415
|
-
* Defines a call to the `
|
|
1359
|
+
* Defines a call to the `setRewardRecipient` function.
|
|
1416
1360
|
*
|
|
1417
1361
|
* Can be passed as a parameter to:
|
|
1418
1362
|
* - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
|
|
@@ -1431,9 +1375,8 @@ export declare namespace start {
|
|
|
1431
1375
|
* }).extend(walletActions)
|
|
1432
1376
|
*
|
|
1433
1377
|
* const hash = await client.sendTransaction({
|
|
1434
|
-
* calls: [actions.
|
|
1435
|
-
*
|
|
1436
|
-
* seconds: 86400,
|
|
1378
|
+
* calls: [actions.reward.setRecipient.call({
|
|
1379
|
+
* recipient: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
|
|
1437
1380
|
* token: '0x20c0000000000000000000000000000000000001',
|
|
1438
1381
|
* })],
|
|
1439
1382
|
* })
|
|
@@ -1444,23 +1387,18 @@ export declare namespace start {
|
|
|
1444
1387
|
*/
|
|
1445
1388
|
function call(args: Args): {
|
|
1446
1389
|
abi: [{
|
|
1447
|
-
readonly name: "
|
|
1390
|
+
readonly name: "setRewardRecipient";
|
|
1448
1391
|
readonly type: "function";
|
|
1449
1392
|
readonly stateMutability: "nonpayable";
|
|
1450
1393
|
readonly inputs: readonly [{
|
|
1451
|
-
readonly type: "
|
|
1452
|
-
readonly name: "
|
|
1453
|
-
}, {
|
|
1454
|
-
readonly type: "uint32";
|
|
1455
|
-
readonly name: "secs";
|
|
1456
|
-
}];
|
|
1457
|
-
readonly outputs: readonly [{
|
|
1458
|
-
readonly type: "uint64";
|
|
1394
|
+
readonly type: "address";
|
|
1395
|
+
readonly name: "recipient";
|
|
1459
1396
|
}];
|
|
1397
|
+
readonly outputs: readonly [];
|
|
1460
1398
|
}];
|
|
1461
|
-
functionName: "
|
|
1399
|
+
functionName: "setRewardRecipient";
|
|
1462
1400
|
} & {
|
|
1463
|
-
args: readonly [
|
|
1401
|
+
args: readonly [recipient: `0x${string}`];
|
|
1464
1402
|
} & {
|
|
1465
1403
|
address: Address;
|
|
1466
1404
|
} & {
|
|
@@ -1468,10 +1406,10 @@ export declare namespace start {
|
|
|
1468
1406
|
to: Address;
|
|
1469
1407
|
};
|
|
1470
1408
|
/**
|
|
1471
|
-
* Extracts the `
|
|
1409
|
+
* Extracts the `RewardRecipientSet` event from logs.
|
|
1472
1410
|
*
|
|
1473
1411
|
* @param logs - The logs.
|
|
1474
|
-
* @returns The `
|
|
1412
|
+
* @returns The `RewardRecipientSet` event.
|
|
1475
1413
|
*/
|
|
1476
1414
|
function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
|
|
1477
1415
|
readonly name: "name";
|
|
@@ -1718,25 +1656,6 @@ export declare namespace start {
|
|
|
1718
1656
|
readonly outputs: readonly [{
|
|
1719
1657
|
readonly type: "bool";
|
|
1720
1658
|
}];
|
|
1721
|
-
}, {
|
|
1722
|
-
readonly name: "feeRecipient";
|
|
1723
|
-
readonly type: "function";
|
|
1724
|
-
readonly stateMutability: "view";
|
|
1725
|
-
readonly inputs: readonly [];
|
|
1726
|
-
readonly outputs: readonly [{
|
|
1727
|
-
readonly type: "address";
|
|
1728
|
-
}];
|
|
1729
|
-
}, {
|
|
1730
|
-
readonly name: "setFeeRecipient";
|
|
1731
|
-
readonly type: "function";
|
|
1732
|
-
readonly stateMutability: "view";
|
|
1733
|
-
readonly inputs: readonly [{
|
|
1734
|
-
readonly type: "address";
|
|
1735
|
-
readonly name: "newRecipient";
|
|
1736
|
-
}];
|
|
1737
|
-
readonly outputs: readonly [{
|
|
1738
|
-
readonly type: "address";
|
|
1739
|
-
}];
|
|
1740
1659
|
}, {
|
|
1741
1660
|
readonly name: "changeTransferPolicyId";
|
|
1742
1661
|
readonly type: "function";
|
|
@@ -1815,19 +1734,14 @@ export declare namespace start {
|
|
|
1815
1734
|
readonly type: "bytes32";
|
|
1816
1735
|
}];
|
|
1817
1736
|
}, {
|
|
1818
|
-
readonly name: "
|
|
1737
|
+
readonly name: "distributeReward";
|
|
1819
1738
|
readonly type: "function";
|
|
1820
1739
|
readonly stateMutability: "nonpayable";
|
|
1821
1740
|
readonly inputs: readonly [{
|
|
1822
1741
|
readonly type: "uint256";
|
|
1823
1742
|
readonly name: "amount";
|
|
1824
|
-
}, {
|
|
1825
|
-
readonly type: "uint32";
|
|
1826
|
-
readonly name: "secs";
|
|
1827
|
-
}];
|
|
1828
|
-
readonly outputs: readonly [{
|
|
1829
|
-
readonly type: "uint64";
|
|
1830
1743
|
}];
|
|
1744
|
+
readonly outputs: readonly [];
|
|
1831
1745
|
}, {
|
|
1832
1746
|
readonly name: "setRewardRecipient";
|
|
1833
1747
|
readonly type: "function";
|
|
@@ -1837,17 +1751,6 @@ export declare namespace start {
|
|
|
1837
1751
|
readonly name: "recipient";
|
|
1838
1752
|
}];
|
|
1839
1753
|
readonly outputs: readonly [];
|
|
1840
|
-
}, {
|
|
1841
|
-
readonly name: "cancelReward";
|
|
1842
|
-
readonly type: "function";
|
|
1843
|
-
readonly stateMutability: "nonpayable";
|
|
1844
|
-
readonly inputs: readonly [{
|
|
1845
|
-
readonly type: "uint64";
|
|
1846
|
-
readonly name: "id";
|
|
1847
|
-
}];
|
|
1848
|
-
readonly outputs: readonly [{
|
|
1849
|
-
readonly type: "uint256";
|
|
1850
|
-
}];
|
|
1851
1754
|
}, {
|
|
1852
1755
|
readonly name: "claimRewards";
|
|
1853
1756
|
readonly type: "function";
|
|
@@ -1856,50 +1759,6 @@ export declare namespace start {
|
|
|
1856
1759
|
readonly outputs: readonly [{
|
|
1857
1760
|
readonly type: "uint256";
|
|
1858
1761
|
}];
|
|
1859
|
-
}, {
|
|
1860
|
-
readonly name: "finalizeStreams";
|
|
1861
|
-
readonly type: "function";
|
|
1862
|
-
readonly stateMutability: "nonpayable";
|
|
1863
|
-
readonly inputs: readonly [{
|
|
1864
|
-
readonly type: "uint64";
|
|
1865
|
-
readonly name: "timestamp";
|
|
1866
|
-
}];
|
|
1867
|
-
readonly outputs: readonly [];
|
|
1868
|
-
}, {
|
|
1869
|
-
readonly name: "getStream";
|
|
1870
|
-
readonly type: "function";
|
|
1871
|
-
readonly stateMutability: "view";
|
|
1872
|
-
readonly inputs: readonly [{
|
|
1873
|
-
readonly type: "uint64";
|
|
1874
|
-
readonly name: "id";
|
|
1875
|
-
}];
|
|
1876
|
-
readonly outputs: readonly [{
|
|
1877
|
-
readonly type: "tuple";
|
|
1878
|
-
readonly components: readonly [{
|
|
1879
|
-
readonly type: "address";
|
|
1880
|
-
readonly name: "funder";
|
|
1881
|
-
}, {
|
|
1882
|
-
readonly type: "uint64";
|
|
1883
|
-
readonly name: "startTime";
|
|
1884
|
-
}, {
|
|
1885
|
-
readonly type: "uint64";
|
|
1886
|
-
readonly name: "endTime";
|
|
1887
|
-
}, {
|
|
1888
|
-
readonly type: "uint256";
|
|
1889
|
-
readonly name: "ratePerSecondScaled";
|
|
1890
|
-
}, {
|
|
1891
|
-
readonly type: "uint256";
|
|
1892
|
-
readonly name: "amountTotal";
|
|
1893
|
-
}];
|
|
1894
|
-
}];
|
|
1895
|
-
}, {
|
|
1896
|
-
readonly name: "totalRewardPerSecond";
|
|
1897
|
-
readonly type: "function";
|
|
1898
|
-
readonly stateMutability: "view";
|
|
1899
|
-
readonly inputs: readonly [];
|
|
1900
|
-
readonly outputs: readonly [{
|
|
1901
|
-
readonly type: "uint256";
|
|
1902
|
-
}];
|
|
1903
1762
|
}, {
|
|
1904
1763
|
readonly name: "optedInSupply";
|
|
1905
1764
|
readonly type: "function";
|
|
@@ -1909,12 +1768,12 @@ export declare namespace start {
|
|
|
1909
1768
|
readonly type: "uint128";
|
|
1910
1769
|
}];
|
|
1911
1770
|
}, {
|
|
1912
|
-
readonly name: "
|
|
1771
|
+
readonly name: "globalRewardPerToken";
|
|
1913
1772
|
readonly type: "function";
|
|
1914
1773
|
readonly stateMutability: "view";
|
|
1915
1774
|
readonly inputs: readonly [];
|
|
1916
1775
|
readonly outputs: readonly [{
|
|
1917
|
-
readonly type: "
|
|
1776
|
+
readonly type: "uint256";
|
|
1918
1777
|
}];
|
|
1919
1778
|
}, {
|
|
1920
1779
|
readonly name: "userRewardInfo";
|
|
@@ -1937,6 +1796,17 @@ export declare namespace start {
|
|
|
1937
1796
|
readonly name: "rewardBalance";
|
|
1938
1797
|
}];
|
|
1939
1798
|
}];
|
|
1799
|
+
}, {
|
|
1800
|
+
readonly name: "getPendingRewards";
|
|
1801
|
+
readonly type: "function";
|
|
1802
|
+
readonly stateMutability: "view";
|
|
1803
|
+
readonly inputs: readonly [{
|
|
1804
|
+
readonly type: "address";
|
|
1805
|
+
readonly name: "account";
|
|
1806
|
+
}];
|
|
1807
|
+
readonly outputs: readonly [{
|
|
1808
|
+
readonly type: "uint128";
|
|
1809
|
+
}];
|
|
1940
1810
|
}, {
|
|
1941
1811
|
readonly name: "Transfer";
|
|
1942
1812
|
readonly type: "event";
|
|
@@ -2079,37 +1949,15 @@ export declare namespace start {
|
|
|
2079
1949
|
readonly indexed: true;
|
|
2080
1950
|
}];
|
|
2081
1951
|
}, {
|
|
2082
|
-
readonly name: "
|
|
1952
|
+
readonly name: "RewardDistributed";
|
|
2083
1953
|
readonly type: "event";
|
|
2084
1954
|
readonly inputs: readonly [{
|
|
2085
1955
|
readonly type: "address";
|
|
2086
1956
|
readonly name: "funder";
|
|
2087
1957
|
readonly indexed: true;
|
|
2088
|
-
}, {
|
|
2089
|
-
readonly type: "uint64";
|
|
2090
|
-
readonly name: "id";
|
|
2091
|
-
readonly indexed: true;
|
|
2092
1958
|
}, {
|
|
2093
1959
|
readonly type: "uint256";
|
|
2094
1960
|
readonly name: "amount";
|
|
2095
|
-
}, {
|
|
2096
|
-
readonly type: "uint32";
|
|
2097
|
-
readonly name: "durationSeconds";
|
|
2098
|
-
}];
|
|
2099
|
-
}, {
|
|
2100
|
-
readonly name: "RewardCanceled";
|
|
2101
|
-
readonly type: "event";
|
|
2102
|
-
readonly inputs: readonly [{
|
|
2103
|
-
readonly type: "address";
|
|
2104
|
-
readonly name: "funder";
|
|
2105
|
-
readonly indexed: true;
|
|
2106
|
-
}, {
|
|
2107
|
-
readonly type: "uint64";
|
|
2108
|
-
readonly name: "id";
|
|
2109
|
-
readonly indexed: true;
|
|
2110
|
-
}, {
|
|
2111
|
-
readonly type: "uint256";
|
|
2112
|
-
readonly name: "refund";
|
|
2113
1961
|
}];
|
|
2114
1962
|
}, {
|
|
2115
1963
|
readonly name: "RewardRecipientSet";
|
|
@@ -2123,18 +1971,6 @@ export declare namespace start {
|
|
|
2123
1971
|
readonly name: "recipient";
|
|
2124
1972
|
readonly indexed: true;
|
|
2125
1973
|
}];
|
|
2126
|
-
}, {
|
|
2127
|
-
readonly name: "FeeRecipientUpdated";
|
|
2128
|
-
readonly type: "event";
|
|
2129
|
-
readonly inputs: readonly [{
|
|
2130
|
-
readonly type: "address";
|
|
2131
|
-
readonly name: "updater";
|
|
2132
|
-
readonly indexed: true;
|
|
2133
|
-
}, {
|
|
2134
|
-
readonly type: "address";
|
|
2135
|
-
readonly name: "newRecipient";
|
|
2136
|
-
readonly indexed: true;
|
|
2137
|
-
}];
|
|
2138
1974
|
}, {
|
|
2139
1975
|
readonly name: "InsufficientBalance";
|
|
2140
1976
|
readonly type: "error";
|
|
@@ -2196,14 +2032,6 @@ export declare namespace start {
|
|
|
2196
2032
|
readonly name: "InvalidAmount";
|
|
2197
2033
|
readonly type: "error";
|
|
2198
2034
|
readonly inputs: readonly [];
|
|
2199
|
-
}, {
|
|
2200
|
-
readonly name: "NotStreamFunder";
|
|
2201
|
-
readonly type: "error";
|
|
2202
|
-
readonly inputs: readonly [];
|
|
2203
|
-
}, {
|
|
2204
|
-
readonly name: "StreamInactive";
|
|
2205
|
-
readonly type: "error";
|
|
2206
|
-
readonly inputs: readonly [];
|
|
2207
2035
|
}, {
|
|
2208
2036
|
readonly name: "NoOptedInSupply";
|
|
2209
2037
|
readonly type: "error";
|
|
@@ -2213,19 +2041,19 @@ export declare namespace start {
|
|
|
2213
2041
|
readonly type: "error";
|
|
2214
2042
|
readonly inputs: readonly [];
|
|
2215
2043
|
}, {
|
|
2216
|
-
readonly name: "
|
|
2044
|
+
readonly name: "ProtectedAddress";
|
|
2217
2045
|
readonly type: "error";
|
|
2218
2046
|
readonly inputs: readonly [];
|
|
2219
2047
|
}, {
|
|
2220
|
-
readonly name: "
|
|
2048
|
+
readonly name: "InvalidToken";
|
|
2221
2049
|
readonly type: "error";
|
|
2222
2050
|
readonly inputs: readonly [];
|
|
2223
2051
|
}, {
|
|
2224
|
-
readonly name: "
|
|
2052
|
+
readonly name: "Uninitialized";
|
|
2225
2053
|
readonly type: "error";
|
|
2226
2054
|
readonly inputs: readonly [];
|
|
2227
2055
|
}, {
|
|
2228
|
-
readonly name: "
|
|
2056
|
+
readonly name: "InvalidTransferPolicyId";
|
|
2229
2057
|
readonly type: "error";
|
|
2230
2058
|
readonly inputs: readonly [];
|
|
2231
2059
|
}, {
|
|
@@ -2337,26 +2165,22 @@ export declare namespace start {
|
|
|
2337
2165
|
readonly name: "Unauthorized";
|
|
2338
2166
|
readonly type: "error";
|
|
2339
2167
|
readonly inputs: readonly [];
|
|
2340
|
-
}], "
|
|
2168
|
+
}], "RewardRecipientSet">;
|
|
2341
2169
|
}
|
|
2342
|
-
export declare namespace
|
|
2343
|
-
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> &
|
|
2170
|
+
export declare namespace setRecipientSync {
|
|
2171
|
+
type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & setRecipient.Args;
|
|
2344
2172
|
type ReturnValue = {
|
|
2345
|
-
/** The
|
|
2346
|
-
|
|
2347
|
-
/** The duration of the stream in seconds (0 for immediate distributions) */
|
|
2348
|
-
durationSeconds: number;
|
|
2349
|
-
/** The address that funded the stream */
|
|
2350
|
-
funder: Address;
|
|
2351
|
-
/** The unique stream ID (0 for immediate distributions, >0 for streaming distributions) */
|
|
2352
|
-
id: bigint;
|
|
2173
|
+
/** The token holder address who set their reward recipient */
|
|
2174
|
+
holder: Address;
|
|
2353
2175
|
/** The transaction receipt */
|
|
2354
2176
|
receipt: Awaited<ReturnType<typeof writeContractSync>>;
|
|
2177
|
+
/** The reward recipient address (zero address indicates opt-out) */
|
|
2178
|
+
recipient: Address;
|
|
2355
2179
|
};
|
|
2356
|
-
type ErrorType =
|
|
2180
|
+
type ErrorType = setRecipient.ErrorType;
|
|
2357
2181
|
}
|
|
2358
2182
|
/**
|
|
2359
|
-
* Watches for reward
|
|
2183
|
+
* Watches for reward distributed events.
|
|
2360
2184
|
*
|
|
2361
2185
|
* @example
|
|
2362
2186
|
* ```ts
|
|
@@ -2369,10 +2193,10 @@ export declare namespace startSync {
|
|
|
2369
2193
|
* transport: http(),
|
|
2370
2194
|
* })
|
|
2371
2195
|
*
|
|
2372
|
-
* const unwatch = Actions.reward.
|
|
2196
|
+
* const unwatch = Actions.reward.watchRewardDistributed(client, {
|
|
2373
2197
|
* token: '0x20c0000000000000000000000000000000000001',
|
|
2374
|
-
*
|
|
2375
|
-
* console.log('Reward
|
|
2198
|
+
* onRewardDistributed: (args, log) => {
|
|
2199
|
+
* console.log('Reward distributed:', args)
|
|
2376
2200
|
* },
|
|
2377
2201
|
* })
|
|
2378
2202
|
* ```
|
|
@@ -2381,16 +2205,16 @@ export declare namespace startSync {
|
|
|
2381
2205
|
* @param parameters - Parameters.
|
|
2382
2206
|
* @returns A function to unsubscribe from the event.
|
|
2383
2207
|
*/
|
|
2384
|
-
export declare function
|
|
2385
|
-
export declare namespace
|
|
2386
|
-
type Args = GetEventArgs<typeof Abis.tip20, '
|
|
2208
|
+
export declare function watchRewardDistributed<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchRewardDistributed.Parameters): WatchContractEventReturnType;
|
|
2209
|
+
export declare namespace watchRewardDistributed {
|
|
2210
|
+
type Args = GetEventArgs<typeof Abis.tip20, 'RewardDistributed', {
|
|
2387
2211
|
IndexedOnly: false;
|
|
2388
2212
|
Required: true;
|
|
2389
2213
|
}>;
|
|
2390
|
-
type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.tip20, '
|
|
2391
|
-
type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.tip20, '
|
|
2392
|
-
/** Callback to invoke when rewards are
|
|
2393
|
-
|
|
2214
|
+
type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.tip20, 'RewardDistributed'>, true>;
|
|
2215
|
+
type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.tip20, 'RewardDistributed', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
|
|
2216
|
+
/** Callback to invoke when rewards are distributed. */
|
|
2217
|
+
onRewardDistributed: (args: Args, log: Log) => void;
|
|
2394
2218
|
/** The TIP20 token address */
|
|
2395
2219
|
token: Address;
|
|
2396
2220
|
};
|