@inco/shield-js 0.0.0-bootstrap.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.
Files changed (65) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +359 -0
  3. package/dist/binary.d.ts +3 -0
  4. package/dist/binary.js +16 -0
  5. package/dist/contracts/abi.d.ts +6800 -0
  6. package/dist/contracts/abi.js +8836 -0
  7. package/dist/contracts/index.d.ts +2 -0
  8. package/dist/contracts/index.js +2 -0
  9. package/dist/contracts/utils.d.ts +25 -0
  10. package/dist/contracts/utils.js +28 -0
  11. package/dist/errors.d.ts +125 -0
  12. package/dist/errors.js +91 -0
  13. package/dist/generated/inco/shield/v2/conductor_connect.d.ts +137 -0
  14. package/dist/generated/inco/shield/v2/conductor_connect.js +141 -0
  15. package/dist/generated/inco/shield/v2/deposit_pb.d.ts +103 -0
  16. package/dist/generated/inco/shield/v2/deposit_pb.js +141 -0
  17. package/dist/generated/inco/shield/v2/drafting_pb.d.ts +279 -0
  18. package/dist/generated/inco/shield/v2/drafting_pb.js +372 -0
  19. package/dist/generated/inco/shield/v2/permission_pb.d.ts +443 -0
  20. package/dist/generated/inco/shield/v2/permission_pb.js +639 -0
  21. package/dist/generated/inco/shield/v2/query_pb.d.ts +103 -0
  22. package/dist/generated/inco/shield/v2/query_pb.js +141 -0
  23. package/dist/generated/inco/shield/v2/types_pb.d.ts +166 -0
  24. package/dist/generated/inco/shield/v2/types_pb.js +261 -0
  25. package/dist/index.d.ts +12 -0
  26. package/dist/index.js +19 -0
  27. package/dist/shield/client.d.ts +72 -0
  28. package/dist/shield/client.js +136 -0
  29. package/dist/shield/convert.d.ts +18 -0
  30. package/dist/shield/convert.js +152 -0
  31. package/dist/shield/encryption.d.ts +86 -0
  32. package/dist/shield/encryption.js +180 -0
  33. package/dist/shield/envelope.d.ts +14 -0
  34. package/dist/shield/envelope.js +29 -0
  35. package/dist/shield/index.d.ts +13 -0
  36. package/dist/shield/index.js +11 -0
  37. package/dist/shield/intent.d.ts +977 -0
  38. package/dist/shield/intent.js +188 -0
  39. package/dist/shield/rpc.d.ts +72 -0
  40. package/dist/shield/rpc.js +423 -0
  41. package/dist/shield/shield.eip712.gen.d.ts +396 -0
  42. package/dist/shield/shield.eip712.gen.js +318 -0
  43. package/dist/shield/types.d.ts +119 -0
  44. package/dist/shield/types.js +4 -0
  45. package/dist/shield/userop/gas-estimation.d.ts +36 -0
  46. package/dist/shield/userop/gas-estimation.js +284 -0
  47. package/dist/shield/userop/index.d.ts +1 -0
  48. package/dist/shield/userop/index.js +1 -0
  49. package/dist/shield/userop/token-exchange.d.ts +54 -0
  50. package/dist/shield/userop/token-exchange.js +165 -0
  51. package/dist/shield/userop/types.d.ts +91 -0
  52. package/dist/shield/userop/types.js +4 -0
  53. package/dist/shield/userop/userOp.d.ts +26 -0
  54. package/dist/shield/userop/userOp.js +98 -0
  55. package/dist/shield/utils/chain.d.ts +2 -0
  56. package/dist/shield/utils/chain.js +8 -0
  57. package/dist/uniswap-adapter/config.d.ts +34 -0
  58. package/dist/uniswap-adapter/config.js +45 -0
  59. package/dist/uniswap-adapter/find-pools.d.ts +91 -0
  60. package/dist/uniswap-adapter/find-pools.js +108 -0
  61. package/dist/uniswap-adapter/index.d.ts +10 -0
  62. package/dist/uniswap-adapter/index.js +13 -0
  63. package/dist/uniswap-adapter/swap.d.ts +344 -0
  64. package/dist/uniswap-adapter/swap.js +309 -0
  65. package/package.json +72 -0
@@ -0,0 +1,318 @@
1
+ // GENERATED FILE — DO NOT EDIT
2
+ // Source: Shield.eip712.sol
3
+ import { encodeAbiParameters, concat, keccak256, stringToBytes } from 'viem';
4
+ export const ASSET_MOVEMENT_TYPEHASH = keccak256(stringToBytes("AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)"));
5
+ export function assetMovementStructHash(s) {
6
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "bytes32" }], [ASSET_MOVEMENT_TYPEHASH, s.assetAdapter, keccak256(s.assetIdentificationArgs), keccak256(s.movementArgs)]));
7
+ }
8
+ export const CALL_TYPEHASH = keccak256(stringToBytes("Call(address target,uint256 value,bytes data)"));
9
+ export function callStructHash(s) {
10
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "uint256" }, { type: "bytes32" }], [CALL_TYPEHASH, s.target, s.value, keccak256(s.data)]));
11
+ }
12
+ export const BALANCE_QUERY_TYPEHASH = keccak256(stringToBytes("BalanceQuery(address requester,address owner,bytes32 assetId,uint64 queryTimestamp)"));
13
+ export function balanceQueryStructHash(s) {
14
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "address" }, { type: "bytes32" }, { type: "uint64" }], [BALANCE_QUERY_TYPEHASH, s.requester, s.owner, s.assetId, s.queryTimestamp]));
15
+ }
16
+ export const HANDLE_PREIMAGE_TYPEHASH = keccak256(stringToBytes("HandlePreimage(bytes32 previousHandle,bytes32 previousBlockHash,uint256 blockTimestamp,bytes32 operationHash)"));
17
+ export function handlePreimageStructHash(s) {
18
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "uint256" }, { type: "bytes32" }], [HANDLE_PREIMAGE_TYPEHASH, s.previousHandle, s.previousBlockHash, s.blockTimestamp, s.operationHash]));
19
+ }
20
+ export const BLOCK_TYPEHASH = keccak256(stringToBytes("Block(uint256 blockNumber,bytes32 blockHash,bytes32 parentBlockHash,bytes32 parentHandle,bytes32 handle,uint256 blockTimestamp,bytes32 eventsHash)"));
21
+ export function blockStructHash(s) {
22
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "uint256" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "uint256" }, { type: "bytes32" }], [BLOCK_TYPEHASH, s.blockNumber, s.blockHash, s.parentBlockHash, s.parentHandle, s.handle, s.blockTimestamp, s.eventsHash]));
23
+ }
24
+ export const DEPOSIT_ATTESTATION_TYPEHASH = keccak256(stringToBytes("DepositAttestation(bytes ciphertext,bytes32 assetId,bytes32 escapeCommitment,bytes receiverEscapeData)"));
25
+ export function depositAttestationStructHash(s) {
26
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }], [DEPOSIT_ATTESTATION_TYPEHASH, keccak256(s.ciphertext), s.assetId, s.escapeCommitment, keccak256(s.receiverEscapeData)]));
27
+ }
28
+ export const DEPOSIT_TYPEHASH = keccak256(stringToBytes("Deposit(DepositAttestation attestation,AssetMovement assetMovement,uint256 amount,address from,bytes teeAttestationSignature)AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)DepositAttestation(bytes ciphertext,bytes32 assetId,bytes32 escapeCommitment,bytes receiverEscapeData)"));
29
+ export function depositStructHash(s) {
30
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "uint256" }, { type: "address" }, { type: "bytes32" }], [DEPOSIT_TYPEHASH, depositAttestationStructHash(s.attestation), assetMovementStructHash(s.assetMovement), s.amount, s.from, keccak256(s.teeAttestationSignature)]));
31
+ }
32
+ export const DEPOSIT_ATTESTATION_REQUEST_TYPEHASH = keccak256(stringToBytes("DepositAttestationRequest(address recipient,bytes32 assetId)"));
33
+ export function depositAttestationRequestStructHash(s) {
34
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "bytes32" }], [DEPOSIT_ATTESTATION_REQUEST_TYPEHASH, s.recipient, s.assetId]));
35
+ }
36
+ export const PERMISSION_TYPEHASH = keccak256(stringToBytes("Permission(address owner,address spender,bytes32 assetId,uint256 allowance,uint256 start,uint256 end,uint256 period,bytes32 agreementHash,bytes32 salt)"));
37
+ export function permissionStructHash(s) {
38
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "address" }, { type: "bytes32" }, { type: "uint256" }, { type: "uint256" }, { type: "uint256" }, { type: "uint256" }, { type: "bytes32" }, { type: "bytes32" }], [PERMISSION_TYPEHASH, s.owner, s.spender, s.assetId, s.allowance, s.start, s.end, s.period, s.agreementHash, s.salt]));
39
+ }
40
+ export const PERMISSION_ATTESTATION_REQUEST_TYPEHASH = keccak256(stringToBytes("PermissionAttestationRequest(Permission permission,uint64 intentExpiry)Permission(address owner,address spender,bytes32 assetId,uint256 allowance,uint256 start,uint256 end,uint256 period,bytes32 agreementHash,bytes32 salt)"));
41
+ export function permissionAttestationRequestStructHash(s) {
42
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "uint64" }], [PERMISSION_ATTESTATION_REQUEST_TYPEHASH, permissionStructHash(s.permission), s.intentExpiry]));
43
+ }
44
+ export const PERMISSION_ATTESTATION_PAYLOAD_TYPEHASH = keccak256(stringToBytes("PermissionAttestationPayload(bytes32 permissionId,Permission permission,bytes32 draftingHandle)Permission(address owner,address spender,bytes32 assetId,uint256 allowance,uint256 start,uint256 end,uint256 period,bytes32 agreementHash,bytes32 salt)"));
45
+ export function permissionAttestationPayloadStructHash(s) {
46
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }], [PERMISSION_ATTESTATION_PAYLOAD_TYPEHASH, s.permissionId, permissionStructHash(s.permission), s.draftingHandle]));
47
+ }
48
+ export const PERMISSION_ATTESTATION_TYPEHASH = keccak256(stringToBytes("PermissionAttestation(PermissionAttestationPayload payload,bytes signature)Permission(address owner,address spender,bytes32 assetId,uint256 allowance,uint256 start,uint256 end,uint256 period,bytes32 agreementHash,bytes32 salt)PermissionAttestationPayload(bytes32 permissionId,Permission permission,bytes32 draftingHandle)"));
49
+ export function permissionAttestationStructHash(s) {
50
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }], [PERMISSION_ATTESTATION_TYPEHASH, permissionAttestationPayloadStructHash(s.payload), keccak256(s.signature)]));
51
+ }
52
+ export const TRANSFER_INTENT_OP_TYPEHASH = keccak256(stringToBytes("TransferIntentOp(address receiver,bytes32 assetId,uint256 amount,bytes memo)"));
53
+ export function transferIntentOpStructHash(s) {
54
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "uint256" }, { type: "bytes32" }], [TRANSFER_INTENT_OP_TYPEHASH, s.receiver, s.assetId, s.amount, keccak256(s.memo)]));
55
+ }
56
+ export const WITHDRAWAL_CORE_INTENT_OP_TYPEHASH = keccak256(stringToBytes("WithdrawalCoreIntentOp(address to,bytes32 assetId,uint256 amount,AssetMovement assetMovement)AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)"));
57
+ export function withdrawalCoreIntentOpStructHash(s) {
58
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "uint256" }, { type: "bytes32" }], [WITHDRAWAL_CORE_INTENT_OP_TYPEHASH, s.to, s.assetId, s.amount, assetMovementStructHash(s.assetMovement)]));
59
+ }
60
+ export const WITHDRAWAL_INTENT_OP_TYPEHASH = keccak256(stringToBytes("WithdrawalIntentOp(WithdrawalCoreIntentOp core,bytes memo)AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)WithdrawalCoreIntentOp(address to,bytes32 assetId,uint256 amount,AssetMovement assetMovement)"));
61
+ export function withdrawalIntentOpStructHash(s) {
62
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }], [WITHDRAWAL_INTENT_OP_TYPEHASH, withdrawalCoreIntentOpStructHash(s.core), keccak256(s.memo)]));
63
+ }
64
+ export const DEFI_INTERACTION_INTENT_OP_TYPEHASH = keccak256(stringToBytes("DefiInteractionIntentOp(WithdrawalCoreIntentOp withdrawal,address defiAdapter,bytes adapterArgs,bytes memo)AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)WithdrawalCoreIntentOp(address to,bytes32 assetId,uint256 amount,AssetMovement assetMovement)"));
65
+ export function defiInteractionIntentOpStructHash(s) {
66
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "bytes32" }], [DEFI_INTERACTION_INTENT_OP_TYPEHASH, withdrawalCoreIntentOpStructHash(s.withdrawal), s.defiAdapter, keccak256(s.adapterArgs), keccak256(s.memo)]));
67
+ }
68
+ export const INDIVIDUAL_REVOCATION_INTENT_OP_TYPEHASH = keccak256(stringToBytes("IndividualRevocationIntentOp(bytes32 permissionId)"));
69
+ export function individualRevocationIntentOpStructHash(s) {
70
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }], [INDIVIDUAL_REVOCATION_INTENT_OP_TYPEHASH, s.permissionId]));
71
+ }
72
+ export const USER_WIDE_REVOCATION_INTENT_OP_TYPEHASH = keccak256(stringToBytes("UserWideRevocationIntentOp(bytes empty)"));
73
+ export function userWideRevocationIntentOpStructHash(s) {
74
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }], [USER_WIDE_REVOCATION_INTENT_OP_TYPEHASH, keccak256(s.empty)]));
75
+ }
76
+ export const GAS_TYPEHASH = keccak256(stringToBytes("Gas(bytes32 assetId,uint256 maxAmount,uint256 callGasLimit,uint256 verificationGasLimit,uint256 preVerificationGas,uint256 paymasterVerificationGasLimit,uint256 paymasterPostOpGasLimit,uint256 maxFeePerGas,uint256 maxPriorityFeePerGas)"));
77
+ export function gasStructHash(s) {
78
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "uint256" }, { type: "uint256" }, { type: "uint256" }, { type: "uint256" }, { type: "uint256" }, { type: "uint256" }, { type: "uint256" }, { type: "uint256" }], [GAS_TYPEHASH, s.assetId, s.maxAmount, s.callGasLimit, s.verificationGasLimit, s.preVerificationGas, s.paymasterVerificationGasLimit, s.paymasterPostOpGasLimit, s.maxFeePerGas, s.maxPriorityFeePerGas]));
79
+ }
80
+ export const TRANSFER_INTENT_TYPEHASH = keccak256(stringToBytes("TransferIntent(TransferIntentOp op,address signer,Gas gas,bytes32 salt)Gas(bytes32 assetId,uint256 maxAmount,uint256 callGasLimit,uint256 verificationGasLimit,uint256 preVerificationGas,uint256 paymasterVerificationGasLimit,uint256 paymasterPostOpGasLimit,uint256 maxFeePerGas,uint256 maxPriorityFeePerGas)TransferIntentOp(address receiver,bytes32 assetId,uint256 amount,bytes memo)"));
81
+ export function transferIntentStructHash(s) {
82
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "bytes32" }], [TRANSFER_INTENT_TYPEHASH, transferIntentOpStructHash(s.op), s.signer, gasStructHash(s.gas), s.salt]));
83
+ }
84
+ export const WITHDRAWAL_INTENT_TYPEHASH = keccak256(stringToBytes("WithdrawalIntent(WithdrawalIntentOp op,address signer,Gas gas,bytes32 salt)AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)Gas(bytes32 assetId,uint256 maxAmount,uint256 callGasLimit,uint256 verificationGasLimit,uint256 preVerificationGas,uint256 paymasterVerificationGasLimit,uint256 paymasterPostOpGasLimit,uint256 maxFeePerGas,uint256 maxPriorityFeePerGas)WithdrawalCoreIntentOp(address to,bytes32 assetId,uint256 amount,AssetMovement assetMovement)WithdrawalIntentOp(WithdrawalCoreIntentOp core,bytes memo)"));
85
+ export function withdrawalIntentStructHash(s) {
86
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "bytes32" }], [WITHDRAWAL_INTENT_TYPEHASH, withdrawalIntentOpStructHash(s.op), s.signer, gasStructHash(s.gas), s.salt]));
87
+ }
88
+ export const DEFI_INTERACTION_INTENT_TYPEHASH = keccak256(stringToBytes("DefiInteractionIntent(DefiInteractionIntentOp op,address signer,Gas gas,bytes32 salt)AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)DefiInteractionIntentOp(WithdrawalCoreIntentOp withdrawal,address defiAdapter,bytes adapterArgs,bytes memo)Gas(bytes32 assetId,uint256 maxAmount,uint256 callGasLimit,uint256 verificationGasLimit,uint256 preVerificationGas,uint256 paymasterVerificationGasLimit,uint256 paymasterPostOpGasLimit,uint256 maxFeePerGas,uint256 maxPriorityFeePerGas)WithdrawalCoreIntentOp(address to,bytes32 assetId,uint256 amount,AssetMovement assetMovement)"));
89
+ export function defiInteractionIntentStructHash(s) {
90
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "bytes32" }], [DEFI_INTERACTION_INTENT_TYPEHASH, defiInteractionIntentOpStructHash(s.op), s.signer, gasStructHash(s.gas), s.salt]));
91
+ }
92
+ export const INDIVIDUAL_REVOCATION_INTENT_TYPEHASH = keccak256(stringToBytes("IndividualRevocationIntent(IndividualRevocationIntentOp op,address signer,Gas gas,bytes32 salt)Gas(bytes32 assetId,uint256 maxAmount,uint256 callGasLimit,uint256 verificationGasLimit,uint256 preVerificationGas,uint256 paymasterVerificationGasLimit,uint256 paymasterPostOpGasLimit,uint256 maxFeePerGas,uint256 maxPriorityFeePerGas)IndividualRevocationIntentOp(bytes32 permissionId)"));
93
+ export function individualRevocationIntentStructHash(s) {
94
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "bytes32" }], [INDIVIDUAL_REVOCATION_INTENT_TYPEHASH, individualRevocationIntentOpStructHash(s.op), s.signer, gasStructHash(s.gas), s.salt]));
95
+ }
96
+ export const USER_WIDE_REVOCATION_INTENT_TYPEHASH = keccak256(stringToBytes("UserWideRevocationIntent(UserWideRevocationIntentOp op,address signer,Gas gas,bytes32 salt)Gas(bytes32 assetId,uint256 maxAmount,uint256 callGasLimit,uint256 verificationGasLimit,uint256 preVerificationGas,uint256 paymasterVerificationGasLimit,uint256 paymasterPostOpGasLimit,uint256 maxFeePerGas,uint256 maxPriorityFeePerGas)UserWideRevocationIntentOp(bytes empty)"));
97
+ export function userWideRevocationIntentStructHash(s) {
98
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "bytes32" }], [USER_WIDE_REVOCATION_INTENT_TYPEHASH, userWideRevocationIntentOpStructHash(s.op), s.signer, gasStructHash(s.gas), s.salt]));
99
+ }
100
+ export const DELEGATED_TRANSFER_INTENT_TYPEHASH = keccak256(stringToBytes("DelegatedTransferIntent(TransferIntent intent,address spender,PermissionAttestation attestation)Gas(bytes32 assetId,uint256 maxAmount,uint256 callGasLimit,uint256 verificationGasLimit,uint256 preVerificationGas,uint256 paymasterVerificationGasLimit,uint256 paymasterPostOpGasLimit,uint256 maxFeePerGas,uint256 maxPriorityFeePerGas)Permission(address owner,address spender,bytes32 assetId,uint256 allowance,uint256 start,uint256 end,uint256 period,bytes32 agreementHash,bytes32 salt)PermissionAttestation(PermissionAttestationPayload payload,bytes signature)PermissionAttestationPayload(bytes32 permissionId,Permission permission,bytes32 draftingHandle)TransferIntent(TransferIntentOp op,address signer,Gas gas,bytes32 salt)TransferIntentOp(address receiver,bytes32 assetId,uint256 amount,bytes memo)"));
101
+ export function delegatedTransferIntentStructHash(s) {
102
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "address" }, { type: "bytes32" }], [DELEGATED_TRANSFER_INTENT_TYPEHASH, transferIntentStructHash(s.intent), s.spender, permissionAttestationStructHash(s.attestation)]));
103
+ }
104
+ export const DELEGATED_WITHDRAWAL_INTENT_TYPEHASH = keccak256(stringToBytes("DelegatedWithdrawalIntent(WithdrawalIntent intent,address spender,PermissionAttestation attestation)AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)Gas(bytes32 assetId,uint256 maxAmount,uint256 callGasLimit,uint256 verificationGasLimit,uint256 preVerificationGas,uint256 paymasterVerificationGasLimit,uint256 paymasterPostOpGasLimit,uint256 maxFeePerGas,uint256 maxPriorityFeePerGas)Permission(address owner,address spender,bytes32 assetId,uint256 allowance,uint256 start,uint256 end,uint256 period,bytes32 agreementHash,bytes32 salt)PermissionAttestation(PermissionAttestationPayload payload,bytes signature)PermissionAttestationPayload(bytes32 permissionId,Permission permission,bytes32 draftingHandle)WithdrawalCoreIntentOp(address to,bytes32 assetId,uint256 amount,AssetMovement assetMovement)WithdrawalIntent(WithdrawalIntentOp op,address signer,Gas gas,bytes32 salt)WithdrawalIntentOp(WithdrawalCoreIntentOp core,bytes memo)"));
105
+ export function delegatedWithdrawalIntentStructHash(s) {
106
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "address" }, { type: "bytes32" }], [DELEGATED_WITHDRAWAL_INTENT_TYPEHASH, withdrawalIntentStructHash(s.intent), s.spender, permissionAttestationStructHash(s.attestation)]));
107
+ }
108
+ export const DELEGATED_DEFI_INTERACTION_INTENT_TYPEHASH = keccak256(stringToBytes("DelegatedDefiInteractionIntent(DefiInteractionIntent intent,address spender,PermissionAttestation attestation)AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)DefiInteractionIntent(DefiInteractionIntentOp op,address signer,Gas gas,bytes32 salt)DefiInteractionIntentOp(WithdrawalCoreIntentOp withdrawal,address defiAdapter,bytes adapterArgs,bytes memo)Gas(bytes32 assetId,uint256 maxAmount,uint256 callGasLimit,uint256 verificationGasLimit,uint256 preVerificationGas,uint256 paymasterVerificationGasLimit,uint256 paymasterPostOpGasLimit,uint256 maxFeePerGas,uint256 maxPriorityFeePerGas)Permission(address owner,address spender,bytes32 assetId,uint256 allowance,uint256 start,uint256 end,uint256 period,bytes32 agreementHash,bytes32 salt)PermissionAttestation(PermissionAttestationPayload payload,bytes signature)PermissionAttestationPayload(bytes32 permissionId,Permission permission,bytes32 draftingHandle)WithdrawalCoreIntentOp(address to,bytes32 assetId,uint256 amount,AssetMovement assetMovement)"));
109
+ export function delegatedDefiInteractionIntentStructHash(s) {
110
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "address" }, { type: "bytes32" }], [DELEGATED_DEFI_INTERACTION_INTENT_TYPEHASH, defiInteractionIntentStructHash(s.intent), s.spender, permissionAttestationStructHash(s.attestation)]));
111
+ }
112
+ export const TRANSFER_TYPEHASH = keccak256(stringToBytes("Transfer(bytes32 draftingHandle,uint64 draftingTimestamp,bytes32 nullifier,bytes32 senderEscapeCommitment,bytes32 receiverEscapeCommitment,bytes senderEscapeData,bytes receiverEscapeData,bytes ciphertext,bytes memo)"));
113
+ export function transferStructHash(s) {
114
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "uint64" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }], [TRANSFER_TYPEHASH, s.draftingHandle, s.draftingTimestamp, s.nullifier, s.senderEscapeCommitment, s.receiverEscapeCommitment, keccak256(s.senderEscapeData), keccak256(s.receiverEscapeData), keccak256(s.ciphertext), keccak256(s.memo)]));
115
+ }
116
+ export const WITHDRAWAL_CORE_TYPEHASH = keccak256(stringToBytes("WithdrawalCore(address to,uint256 amount,bytes32 nullifier,bytes32 draftingHandle,uint64 draftingTimestamp,AssetMovement assetMovement,bytes ciphertext,bytes32 senderEscapeCommitment,bytes senderEscapeData)AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)"));
117
+ export function withdrawalCoreStructHash(s) {
118
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "uint256" }, { type: "bytes32" }, { type: "bytes32" }, { type: "uint64" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }], [WITHDRAWAL_CORE_TYPEHASH, s.to, s.amount, s.nullifier, s.draftingHandle, s.draftingTimestamp, assetMovementStructHash(s.assetMovement), keccak256(s.ciphertext), s.senderEscapeCommitment, keccak256(s.senderEscapeData)]));
119
+ }
120
+ export const WITHDRAWAL_TYPEHASH = keccak256(stringToBytes("Withdrawal(WithdrawalCore core,bytes memo)AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)WithdrawalCore(address to,uint256 amount,bytes32 nullifier,bytes32 draftingHandle,uint64 draftingTimestamp,AssetMovement assetMovement,bytes ciphertext,bytes32 senderEscapeCommitment,bytes senderEscapeData)"));
121
+ export function withdrawalStructHash(s) {
122
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }], [WITHDRAWAL_TYPEHASH, withdrawalCoreStructHash(s.core), keccak256(s.memo)]));
123
+ }
124
+ export const DEFI_INTERACTION_TYPEHASH = keccak256(stringToBytes("DefiInteraction(WithdrawalCore withdrawal,address defiAdapter,bytes adapterArgs,bytes memo)AssetMovement(address assetAdapter,bytes assetIdentificationArgs,bytes movementArgs)WithdrawalCore(address to,uint256 amount,bytes32 nullifier,bytes32 draftingHandle,uint64 draftingTimestamp,AssetMovement assetMovement,bytes ciphertext,bytes32 senderEscapeCommitment,bytes senderEscapeData)"));
125
+ export function defiInteractionStructHash(s) {
126
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "bytes32" }], [DEFI_INTERACTION_TYPEHASH, withdrawalCoreStructHash(s.withdrawal), s.defiAdapter, keccak256(s.adapterArgs), keccak256(s.memo)]));
127
+ }
128
+ export const INDIVIDUAL_REVOCATION_TYPEHASH = keccak256(stringToBytes("IndividualRevocation(bytes ciphertext,bytes32 draftingHandle,uint64 draftingTimestamp)"));
129
+ export function individualRevocationStructHash(s) {
130
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "uint64" }], [INDIVIDUAL_REVOCATION_TYPEHASH, keccak256(s.ciphertext), s.draftingHandle, s.draftingTimestamp]));
131
+ }
132
+ export const USER_WIDE_REVOCATION_TYPEHASH = keccak256(stringToBytes("UserWideRevocation(bytes ciphertext,bytes32 draftingHandle,uint64 draftingTimestamp)"));
133
+ export function userWideRevocationStructHash(s) {
134
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "uint64" }], [USER_WIDE_REVOCATION_TYPEHASH, keccak256(s.ciphertext), s.draftingHandle, s.draftingTimestamp]));
135
+ }
136
+ export const TRANSFER_PLAINTEXT_TYPEHASH = keccak256(stringToBytes("TransferPlaintext(address sender,address receiver,uint256 amount,bytes32 assetId)"));
137
+ export function transferPlaintextStructHash(s) {
138
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "address" }, { type: "uint256" }, { type: "bytes32" }], [TRANSFER_PLAINTEXT_TYPEHASH, s.sender, s.receiver, s.amount, s.assetId]));
139
+ }
140
+ export const WITHDRAWAL_PLAINTEXT_TYPEHASH = keccak256(stringToBytes("WithdrawalPlaintext(address sender)"));
141
+ export function withdrawalPlaintextStructHash(s) {
142
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }], [WITHDRAWAL_PLAINTEXT_TYPEHASH, s.sender]));
143
+ }
144
+ export const DEPOSIT_PLAINTEXT_TYPEHASH = keccak256(stringToBytes("DepositPlaintext(address receiver)"));
145
+ export function depositPlaintextStructHash(s) {
146
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }], [DEPOSIT_PLAINTEXT_TYPEHASH, s.receiver]));
147
+ }
148
+ export const INDIVIDUAL_REVOCATION_PLAINTEXT_TYPEHASH = keccak256(stringToBytes("IndividualRevocationPlaintext(address owner,bytes32 permissionId)"));
149
+ export function individualRevocationPlaintextStructHash(s) {
150
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "bytes32" }], [INDIVIDUAL_REVOCATION_PLAINTEXT_TYPEHASH, s.owner, s.permissionId]));
151
+ }
152
+ export const USER_WIDE_REVOCATION_PLAINTEXT_TYPEHASH = keccak256(stringToBytes("UserWideRevocationPlaintext(address owner)"));
153
+ export function userWideRevocationPlaintextStructHash(s) {
154
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }], [USER_WIDE_REVOCATION_PLAINTEXT_TYPEHASH, s.owner]));
155
+ }
156
+ export const SENDER_ESCAPE_PLAINTEXT_TYPEHASH = keccak256(stringToBytes("SenderEscapePlaintext(address sender,bytes32 assetId,bytes32 draftingHandle,uint256 spendAmount,uint256 balanceSnapshot,uint64 chequeNumber,uint64 oldestPossiblyOutstanding)"));
157
+ export function senderEscapePlaintextStructHash(s) {
158
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "bytes32" }, { type: "uint256" }, { type: "uint256" }, { type: "uint64" }, { type: "uint64" }], [SENDER_ESCAPE_PLAINTEXT_TYPEHASH, s.sender, s.assetId, s.draftingHandle, s.spendAmount, s.balanceSnapshot, s.chequeNumber, s.oldestPossiblyOutstanding]));
159
+ }
160
+ export const RECEIVER_ESCAPE_PLAINTEXT_TYPEHASH = keccak256(stringToBytes("ReceiverEscapePlaintext(address receiver,bytes32 assetId,bytes32 draftingHandle,uint256 receiveAmount,uint256 balanceSnapshot,bytes32 chequeNullifier,uint64 senderChequeNumber,uint64 oldestPossiblyOutstandingSend)"));
161
+ export function receiverEscapePlaintextStructHash(s) {
162
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "bytes32" }, { type: "uint256" }, { type: "uint256" }, { type: "bytes32" }, { type: "uint64" }, { type: "uint64" }], [RECEIVER_ESCAPE_PLAINTEXT_TYPEHASH, s.receiver, s.assetId, s.draftingHandle, s.receiveAmount, s.balanceSnapshot, s.chequeNullifier, s.senderChequeNumber, s.oldestPossiblyOutstandingSend]));
163
+ }
164
+ export const GET_PERMISSIONS_BY_OWNER_TYPEHASH = keccak256(stringToBytes("GetPermissionsByOwner(address requester,bool includeExpired,uint64 timestamp)"));
165
+ export function getPermissionsByOwnerStructHash(s) {
166
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "bool" }, { type: "uint64" }], [GET_PERMISSIONS_BY_OWNER_TYPEHASH, s.requester, s.includeExpired, s.timestamp]));
167
+ }
168
+ export const GET_PERMISSIONS_BY_SPENDER_TYPEHASH = keccak256(stringToBytes("GetPermissionsBySpender(address requester,bool includeExpired,uint64 timestamp)"));
169
+ export function getPermissionsBySpenderStructHash(s) {
170
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "bool" }, { type: "uint64" }], [GET_PERMISSIONS_BY_SPENDER_TYPEHASH, s.requester, s.includeExpired, s.timestamp]));
171
+ }
172
+ export const GET_PERMISSION_DETAILS_TYPEHASH = keccak256(stringToBytes("GetPermissionDetails(address requester,bytes32 permissionId,uint64 timestamp)"));
173
+ export function getPermissionDetailsStructHash(s) {
174
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "uint64" }], [GET_PERMISSION_DETAILS_TYPEHASH, s.requester, s.permissionId, s.timestamp]));
175
+ }
176
+ export const GET_SPENDABLE_TYPEHASH = keccak256(stringToBytes("GetSpendable(address requester,bytes32 permissionId,uint64 timestamp)"));
177
+ export function getSpendableStructHash(s) {
178
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "bytes32" }, { type: "uint64" }], [GET_SPENDABLE_TYPEHASH, s.requester, s.permissionId, s.timestamp]));
179
+ }
180
+ export const GET_OWNER_GENERATION_TYPEHASH = keccak256(stringToBytes("GetOwnerGeneration(address requester,uint64 timestamp)"));
181
+ export function getOwnerGenerationStructHash(s) {
182
+ return keccak256(encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "uint64" }], [GET_OWNER_GENERATION_TYPEHASH, s.requester, s.timestamp]));
183
+ }
184
+ export function assetMovementDigest(s, domainSeparator) {
185
+ return keccak256(concat(["0x1901", domainSeparator, assetMovementStructHash(s)]));
186
+ }
187
+ export function callDigest(s, domainSeparator) {
188
+ return keccak256(concat(["0x1901", domainSeparator, callStructHash(s)]));
189
+ }
190
+ export function balanceQueryDigest(s, domainSeparator) {
191
+ return keccak256(concat(["0x1901", domainSeparator, balanceQueryStructHash(s)]));
192
+ }
193
+ export function handlePreimageDigest(s, domainSeparator) {
194
+ return keccak256(concat(["0x1901", domainSeparator, handlePreimageStructHash(s)]));
195
+ }
196
+ export function blockDigest(s, domainSeparator) {
197
+ return keccak256(concat(["0x1901", domainSeparator, blockStructHash(s)]));
198
+ }
199
+ export function depositAttestationDigest(s, domainSeparator) {
200
+ return keccak256(concat(["0x1901", domainSeparator, depositAttestationStructHash(s)]));
201
+ }
202
+ export function depositDigest(s, domainSeparator) {
203
+ return keccak256(concat(["0x1901", domainSeparator, depositStructHash(s)]));
204
+ }
205
+ export function depositAttestationRequestDigest(s, domainSeparator) {
206
+ return keccak256(concat(["0x1901", domainSeparator, depositAttestationRequestStructHash(s)]));
207
+ }
208
+ export function permissionDigest(s, domainSeparator) {
209
+ return keccak256(concat(["0x1901", domainSeparator, permissionStructHash(s)]));
210
+ }
211
+ export function permissionAttestationRequestDigest(s, domainSeparator) {
212
+ return keccak256(concat(["0x1901", domainSeparator, permissionAttestationRequestStructHash(s)]));
213
+ }
214
+ export function permissionAttestationPayloadDigest(s, domainSeparator) {
215
+ return keccak256(concat(["0x1901", domainSeparator, permissionAttestationPayloadStructHash(s)]));
216
+ }
217
+ export function permissionAttestationDigest(s, domainSeparator) {
218
+ return keccak256(concat(["0x1901", domainSeparator, permissionAttestationStructHash(s)]));
219
+ }
220
+ export function transferIntentOpDigest(s, domainSeparator) {
221
+ return keccak256(concat(["0x1901", domainSeparator, transferIntentOpStructHash(s)]));
222
+ }
223
+ export function withdrawalCoreIntentOpDigest(s, domainSeparator) {
224
+ return keccak256(concat(["0x1901", domainSeparator, withdrawalCoreIntentOpStructHash(s)]));
225
+ }
226
+ export function withdrawalIntentOpDigest(s, domainSeparator) {
227
+ return keccak256(concat(["0x1901", domainSeparator, withdrawalIntentOpStructHash(s)]));
228
+ }
229
+ export function defiInteractionIntentOpDigest(s, domainSeparator) {
230
+ return keccak256(concat(["0x1901", domainSeparator, defiInteractionIntentOpStructHash(s)]));
231
+ }
232
+ export function individualRevocationIntentOpDigest(s, domainSeparator) {
233
+ return keccak256(concat(["0x1901", domainSeparator, individualRevocationIntentOpStructHash(s)]));
234
+ }
235
+ export function userWideRevocationIntentOpDigest(s, domainSeparator) {
236
+ return keccak256(concat(["0x1901", domainSeparator, userWideRevocationIntentOpStructHash(s)]));
237
+ }
238
+ export function gasDigest(s, domainSeparator) {
239
+ return keccak256(concat(["0x1901", domainSeparator, gasStructHash(s)]));
240
+ }
241
+ export function transferIntentDigest(s, domainSeparator) {
242
+ return keccak256(concat(["0x1901", domainSeparator, transferIntentStructHash(s)]));
243
+ }
244
+ export function withdrawalIntentDigest(s, domainSeparator) {
245
+ return keccak256(concat(["0x1901", domainSeparator, withdrawalIntentStructHash(s)]));
246
+ }
247
+ export function defiInteractionIntentDigest(s, domainSeparator) {
248
+ return keccak256(concat(["0x1901", domainSeparator, defiInteractionIntentStructHash(s)]));
249
+ }
250
+ export function individualRevocationIntentDigest(s, domainSeparator) {
251
+ return keccak256(concat(["0x1901", domainSeparator, individualRevocationIntentStructHash(s)]));
252
+ }
253
+ export function userWideRevocationIntentDigest(s, domainSeparator) {
254
+ return keccak256(concat(["0x1901", domainSeparator, userWideRevocationIntentStructHash(s)]));
255
+ }
256
+ export function delegatedTransferIntentDigest(s, domainSeparator) {
257
+ return keccak256(concat(["0x1901", domainSeparator, delegatedTransferIntentStructHash(s)]));
258
+ }
259
+ export function delegatedWithdrawalIntentDigest(s, domainSeparator) {
260
+ return keccak256(concat(["0x1901", domainSeparator, delegatedWithdrawalIntentStructHash(s)]));
261
+ }
262
+ export function delegatedDefiInteractionIntentDigest(s, domainSeparator) {
263
+ return keccak256(concat(["0x1901", domainSeparator, delegatedDefiInteractionIntentStructHash(s)]));
264
+ }
265
+ export function transferDigest(s, domainSeparator) {
266
+ return keccak256(concat(["0x1901", domainSeparator, transferStructHash(s)]));
267
+ }
268
+ export function withdrawalCoreDigest(s, domainSeparator) {
269
+ return keccak256(concat(["0x1901", domainSeparator, withdrawalCoreStructHash(s)]));
270
+ }
271
+ export function withdrawalDigest(s, domainSeparator) {
272
+ return keccak256(concat(["0x1901", domainSeparator, withdrawalStructHash(s)]));
273
+ }
274
+ export function defiInteractionDigest(s, domainSeparator) {
275
+ return keccak256(concat(["0x1901", domainSeparator, defiInteractionStructHash(s)]));
276
+ }
277
+ export function individualRevocationDigest(s, domainSeparator) {
278
+ return keccak256(concat(["0x1901", domainSeparator, individualRevocationStructHash(s)]));
279
+ }
280
+ export function userWideRevocationDigest(s, domainSeparator) {
281
+ return keccak256(concat(["0x1901", domainSeparator, userWideRevocationStructHash(s)]));
282
+ }
283
+ export function transferPlaintextDigest(s, domainSeparator) {
284
+ return keccak256(concat(["0x1901", domainSeparator, transferPlaintextStructHash(s)]));
285
+ }
286
+ export function withdrawalPlaintextDigest(s, domainSeparator) {
287
+ return keccak256(concat(["0x1901", domainSeparator, withdrawalPlaintextStructHash(s)]));
288
+ }
289
+ export function depositPlaintextDigest(s, domainSeparator) {
290
+ return keccak256(concat(["0x1901", domainSeparator, depositPlaintextStructHash(s)]));
291
+ }
292
+ export function individualRevocationPlaintextDigest(s, domainSeparator) {
293
+ return keccak256(concat(["0x1901", domainSeparator, individualRevocationPlaintextStructHash(s)]));
294
+ }
295
+ export function userWideRevocationPlaintextDigest(s, domainSeparator) {
296
+ return keccak256(concat(["0x1901", domainSeparator, userWideRevocationPlaintextStructHash(s)]));
297
+ }
298
+ export function senderEscapePlaintextDigest(s, domainSeparator) {
299
+ return keccak256(concat(["0x1901", domainSeparator, senderEscapePlaintextStructHash(s)]));
300
+ }
301
+ export function receiverEscapePlaintextDigest(s, domainSeparator) {
302
+ return keccak256(concat(["0x1901", domainSeparator, receiverEscapePlaintextStructHash(s)]));
303
+ }
304
+ export function getPermissionsByOwnerDigest(s, domainSeparator) {
305
+ return keccak256(concat(["0x1901", domainSeparator, getPermissionsByOwnerStructHash(s)]));
306
+ }
307
+ export function getPermissionsBySpenderDigest(s, domainSeparator) {
308
+ return keccak256(concat(["0x1901", domainSeparator, getPermissionsBySpenderStructHash(s)]));
309
+ }
310
+ export function getPermissionDetailsDigest(s, domainSeparator) {
311
+ return keccak256(concat(["0x1901", domainSeparator, getPermissionDetailsStructHash(s)]));
312
+ }
313
+ export function getSpendableDigest(s, domainSeparator) {
314
+ return keccak256(concat(["0x1901", domainSeparator, getSpendableStructHash(s)]));
315
+ }
316
+ export function getOwnerGenerationDigest(s, domainSeparator) {
317
+ return keccak256(concat(["0x1901", domainSeparator, getOwnerGenerationStructHash(s)]));
318
+ }
@@ -0,0 +1,119 @@
1
+ import type { Transport as ConnectTransport } from '@connectrpc/connect';
2
+ import type { Hex, Transport as ViemTransport, WalletClient } from 'viem';
3
+ /** Minimal signer interface, structurally compatible with viem LocalAccount. */
4
+ export interface ShieldSigner {
5
+ address: Hex;
6
+ sign(params: {
7
+ hash: Hex;
8
+ }): Promise<Hex>;
9
+ }
10
+ /**
11
+ * Accepted signer types. Either:
12
+ * - A viem `WalletClient` (browser wallets or backend with privateKeyToAccount)
13
+ * - A `ShieldSigner` (custom signer with raw hash signing)
14
+ */
15
+ export type ShieldSignerInput = WalletClient | ShieldSigner;
16
+ /** Configuration for creating a ShieldClient. */
17
+ export interface ShieldConfig {
18
+ grpcTransport: ConnectTransport;
19
+ /**
20
+ * RPC transport for Ethereum-compatible chains.
21
+ */
22
+ viemTransport?: ViemTransport;
23
+ chainId: bigint;
24
+ shieldAddress: Hex;
25
+ signer: ShieldSignerInput;
26
+ /**
27
+ * Serialized TEE public key for encrypting envelopes (known out of band).
28
+ * TODO: SDK should fetch this from the IncoShield contract rather than
29
+ * requiring it as config. Tracked separately.
30
+ */
31
+ teePublicKey: Uint8Array;
32
+ /** Bundler URL. Defaults to the Pimlico public bundler if not provided. */
33
+ bundlerUrl?: string;
34
+ }
35
+ /** Parameters for the `getBalance` RPC call. */
36
+ export interface GetBalanceParams {
37
+ address: Hex;
38
+ assetId: Hex;
39
+ /** Query balance at a specific block. Defaults to latest. */
40
+ atBlock?: bigint;
41
+ }
42
+ /** Balance breakdown for an account and asset. */
43
+ export interface Balance {
44
+ confirmed: bigint;
45
+ pending: bigint;
46
+ available: bigint;
47
+ }
48
+ /**
49
+ * Per-issuance salt — 32-byte hex. Distinguishes intents that are otherwise
50
+ * field-identical and gives `permissionId` cryptographic unguessability against
51
+ * outside observers of revocation events.
52
+ */
53
+ export type Salt = Hex;
54
+ /**
55
+ * Owner's terms for a delegated-spend grant. Owner signs this struct (EIP-712)
56
+ * once and submits it to the TEE during issuance; the TEE returns a
57
+ * `PermissionAttestation` and the spender carries that attestation thereafter.
58
+ *
59
+ * `permissionId` is recomputed from these fields by both sides; it is not
60
+ * carried in the intent itself. The TEE's `draftingHandle` anchor is chosen
61
+ * at issuance from enclave state, not supplied by the user.
62
+ *
63
+ * @deprecated
64
+ * TODO: Remove as part of https://github.com/Inco-fhevm/shield/issues/499
65
+ */
66
+ export interface PermissionIntent {
67
+ owner: Hex;
68
+ spender: Hex;
69
+ assetId: Hex;
70
+ allowance: bigint;
71
+ start: bigint;
72
+ end: bigint;
73
+ period: bigint;
74
+ agreementHash: Hex;
75
+ salt: Salt;
76
+ intentExpiry: bigint;
77
+ }
78
+ /** Parameters for the `requestDepositAttestation` RPC call. */
79
+ export interface RequestDepositAttestationParams {
80
+ recipient: Hex;
81
+ assetAdapter: Hex;
82
+ assetIdentificationArgs: Hex;
83
+ memo: Hex;
84
+ escapeHatch: Hex;
85
+ }
86
+ /** TEE-issued deposit attestation: ciphertext for the recipient and signature over it. */
87
+ export interface DepositAttestation {
88
+ toCiphertext: Hex;
89
+ teeSignature: Hex;
90
+ }
91
+ export interface GetPermissionsByOwnerParams {
92
+ includeExpired?: boolean;
93
+ }
94
+ export interface GetPermissionsBySpenderParams {
95
+ includeExpired?: boolean;
96
+ }
97
+ export type PermissionStatusType = 'unspecified' | 'active' | 'not_yet_active' | 'expired' | 'revoked' | 'generation_revoked';
98
+ export interface PermissionInfo {
99
+ permissionId: Hex;
100
+ owner: Hex;
101
+ spender: Hex;
102
+ assetId: Hex;
103
+ allowance: bigint;
104
+ start: bigint;
105
+ end: bigint;
106
+ period: bigint;
107
+ agreementHash: Hex;
108
+ spentInCurrentPeriod: bigint;
109
+ availableAllowance: bigint;
110
+ status: PermissionStatusType;
111
+ }
112
+ export interface GetPermissionDetailsParams {
113
+ permissionId: Hex;
114
+ }
115
+ export interface PermissionDetails {
116
+ permission: PermissionInfo;
117
+ found: boolean;
118
+ }
119
+ export { ShieldError } from '../errors.js';
@@ -0,0 +1,4 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Errors (re-export — concrete classes live in `../errors.ts`)
3
+ // ---------------------------------------------------------------------------
4
+ export { ShieldError } from '../errors.js';
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Constitution: Creates an intent with gas estimation.
3
+ *
4
+ * The flow is:
5
+ * 1. Create a placeholder UserOp from the user's intent op
6
+ * 2. Get the gas estimate from the bundler using the placeholder UserOp
7
+ * 3. Assemble the final intent with the gas estimate
8
+ */
9
+ import { type Address, type Hex, type PublicClient } from 'viem';
10
+ import { type UserOperation } from 'viem/account-abstraction';
11
+ import type { IntentOp, UserGasParams } from '../intent.js';
12
+ import type { ShieldConfig, ShieldSigner } from '../types.js';
13
+ declare const ENTRYPOINT_VERSION: "0.7";
14
+ /** Placeholder `abi.encode(bytes[] signers, bytes[] sigs)`. Real signer addresses
15
+ * required: OZ's `isSigner` check runs before any `ecrecover`, so zero-address
16
+ * signers short-circuit the validation loop and under-quote gas. */
17
+ export declare function placeholderMultisig(signers: readonly Address[]): Hex;
18
+ /** Exported for tests that pin the expected placeholder byte counts. */
19
+ export declare const PLACEHOLDER_SIZES: {
20
+ readonly transferCiphertext: number;
21
+ readonly withdrawalCiphertext: number;
22
+ readonly senderEscapeData: number;
23
+ readonly receiverEscapeData: number;
24
+ readonly erc20AssetIdentificationArgs: 32;
25
+ readonly erc20MovementArgs: 32;
26
+ };
27
+ /**
28
+ * Build an unsigned UserOp for bundler gas estimation.
29
+ *
30
+ * Invariant: every wire-shape field matches the size of what the conductor will
31
+ * submit. Cheque fields are sized against worst-case plaintexts (over-estimate,
32
+ * never under); adapter args are ERC-20-sized — new adapters need entries in
33
+ * `PLACEHOLDER_SIZES`.
34
+ */
35
+ export declare function userOpFromIntentForGasEstimation(intentOp: IntentOp, signer: ShieldSigner, shieldConfig: ShieldConfig, publicClient: PublicClient, gas: UserGasParams): Promise<UserOperation<typeof ENTRYPOINT_VERSION>>;
36
+ export {};