@totalis/hip4-client 0.84.1 → 0.86.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.
@@ -333,6 +333,49 @@ export type PayoutAuthorization = {
333
333
  };
334
334
  /** USDC TransferWithAuthorization for a Totalis withdrawal payout, under the deployment's USDC domain. */
335
335
  export declare function transferWithAuthorizationTypedData(deployment: UsdcDeployment, payout: PayoutAuthorization): UsdcTypedData<"TransferWithAuthorization">;
336
+ /** A USDC EIP-2612 permit setting the account wallet's approval to WalletAccept (`GET /v1/me/wallet-approval` `spender`) to `value`; 0 revokes it. */
337
+ export type WalletPermit = {
338
+ readonly owner: string;
339
+ readonly spender: string;
340
+ readonly value: string;
341
+ readonly nonce: string;
342
+ readonly deadline: string;
343
+ };
344
+ /** USDC Permit(owner, spender, value, nonce, deadline) under the deployment's USDC domain, for `POST /v1/me/wallet-approval`. */
345
+ export declare function walletPermitTypedData(deployment: UsdcDeployment, permit: WalletPermit): {
346
+ domain: {
347
+ readonly name: "USDC";
348
+ readonly version: "2";
349
+ readonly chainId: bigint;
350
+ readonly verifyingContract: Hex;
351
+ };
352
+ types: {
353
+ Permit: readonly [{
354
+ readonly name: "owner";
355
+ readonly type: "address";
356
+ }, {
357
+ readonly name: "spender";
358
+ readonly type: "address";
359
+ }, {
360
+ readonly name: "value";
361
+ readonly type: "uint256";
362
+ }, {
363
+ readonly name: "nonce";
364
+ readonly type: "uint256";
365
+ }, {
366
+ readonly name: "deadline";
367
+ readonly type: "uint256";
368
+ }];
369
+ };
370
+ primaryType: "Permit";
371
+ message: {
372
+ owner: `0x${string}`;
373
+ spender: `0x${string}`;
374
+ value: bigint;
375
+ nonce: bigint;
376
+ deadline: bigint;
377
+ };
378
+ };
336
379
  /** Any EIP-712 signer. `toTotalisSigner` in `./signer` adapts viem, EIP-1193 and ethers signers. */
337
380
  export type TypedDataSigner = {
338
381
  signTypedData(typedData: TypedData): Promise<Hex>;
@@ -317,6 +317,23 @@ export function transferWithAuthorizationTypedData(deployment, payout) {
317
317
  },
318
318
  };
319
319
  }
320
+ const permitFields = [
321
+ { name: "owner", type: "address" },
322
+ { name: "spender", type: "address" },
323
+ { name: "value", type: "uint256" },
324
+ { name: "nonce", type: "uint256" },
325
+ { name: "deadline", type: "uint256" },
326
+ ];
327
+ /** USDC Permit(owner, spender, value, nonce, deadline) under the deployment's USDC domain, for `POST /v1/me/wallet-approval`. */
328
+ export function walletPermitTypedData(deployment, permit) {
329
+ return {
330
+ domain: usdcDomain(deployment), types: { Permit: permitFields }, primaryType: "Permit",
331
+ message: {
332
+ owner: address(permit.owner), spender: address(permit.spender), value: BigInt(permit.value),
333
+ nonce: BigInt(permit.nonce), deadline: BigInt(permit.deadline),
334
+ },
335
+ };
336
+ }
320
337
  /** Lowercase hex with v in {27, 28}: the venue rejects v = 0/1. Longer ERC-1271 signatures pass through. */
321
338
  export function canonicalSignature(signature) {
322
339
  const lower = signature.toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@totalis/hip4-client",
3
- "version": "0.84.1",
3
+ "version": "0.86.0",
4
4
  "description": "Totalis HIP-4 SDK: typed HTTP clients, signer-agnostic typed data, a retrying request layer, pagination, a realtime stream and taker/maker flows",
5
5
  "type": "module",
6
6
  "files": [