@metamask/smart-accounts-kit 1.3.0 → 1.4.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 (58) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/actions/index.cjs +4 -4
  3. package/dist/actions/index.d.cts +1 -1
  4. package/dist/actions/index.d.ts +1 -1
  5. package/dist/actions/index.mjs +3 -3
  6. package/dist/{caveats-CQbtzOKm.d.ts → caveats-BhjGBVHX.d.ts} +1 -1
  7. package/dist/{caveats-Cey0wm33.d.cts → caveats-CeHBbmt_.d.cts} +1 -1
  8. package/dist/{chunk-AJWMPR7X.cjs → chunk-6CEOFJY5.cjs} +122 -50
  9. package/dist/chunk-6CEOFJY5.cjs.map +1 -0
  10. package/dist/{chunk-AC2BQSYP.mjs → chunk-DVJX76J3.mjs} +2 -2
  11. package/dist/{chunk-Z4D7ZWVB.mjs → chunk-EEIIVBNV.mjs} +22 -18
  12. package/dist/chunk-EEIIVBNV.mjs.map +1 -0
  13. package/dist/{chunk-LQXOM3TA.mjs → chunk-FG2CQGSE.mjs} +3 -3
  14. package/dist/{chunk-26PADMXR.mjs → chunk-HQHXGWNJ.mjs} +4 -4
  15. package/dist/{chunk-3PBVHNYP.cjs → chunk-MVBU3LRV.cjs} +10 -10
  16. package/dist/{chunk-3PBVHNYP.cjs.map → chunk-MVBU3LRV.cjs.map} +1 -1
  17. package/dist/{chunk-FKI4OME5.mjs → chunk-R2WT54GZ.mjs} +78 -6
  18. package/dist/chunk-R2WT54GZ.mjs.map +1 -0
  19. package/dist/{chunk-57I2FJY7.cjs → chunk-RR2AMG4A.cjs} +102 -102
  20. package/dist/{chunk-57I2FJY7.cjs.map → chunk-RR2AMG4A.cjs.map} +1 -1
  21. package/dist/{chunk-DLCTHNAE.cjs → chunk-SO5JAXGD.cjs} +11 -11
  22. package/dist/{chunk-DLCTHNAE.cjs.map → chunk-SO5JAXGD.cjs.map} +1 -1
  23. package/dist/{chunk-SZOX7K2V.cjs → chunk-TMO23YRP.cjs} +19 -15
  24. package/dist/chunk-TMO23YRP.cjs.map +1 -0
  25. package/dist/{chunk-GZ7HHI2D.cjs → chunk-XZ7UMCG3.cjs} +12 -12
  26. package/dist/{chunk-GZ7HHI2D.cjs.map → chunk-XZ7UMCG3.cjs.map} +1 -1
  27. package/dist/{chunk-KBSFVKUB.mjs → chunk-ZGBFPD4O.mjs} +2 -2
  28. package/dist/contracts/index.cjs +5 -5
  29. package/dist/contracts/index.d.cts +2 -2
  30. package/dist/contracts/index.d.ts +2 -2
  31. package/dist/contracts/index.mjs +4 -4
  32. package/dist/{delegation-Bx4FEAIU.d.ts → delegation-CR99q1-n.d.ts} +2 -6
  33. package/dist/{delegation-KbWHzRxV.d.cts → delegation-DoVULGYE.d.cts} +2 -6
  34. package/dist/experimental/index.cjs +7 -7
  35. package/dist/experimental/index.mjs +1 -1
  36. package/dist/{index-BDC55AA9.d.cts → index-BToRQKyJ.d.cts} +23 -3
  37. package/dist/{index-DhG2lH80.d.ts → index-Cg-JakqA.d.ts} +23 -3
  38. package/dist/{index-D2THBlfm.d.ts → index-DRKgDSZW.d.ts} +1 -1
  39. package/dist/{index-DE87r5KY.d.cts → index-DzL9ccjU.d.cts} +1 -1
  40. package/dist/index.cjs +22 -20
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +6 -6
  43. package/dist/index.d.ts +6 -6
  44. package/dist/index.mjs +9 -7
  45. package/dist/index.mjs.map +1 -1
  46. package/dist/utils/index.cjs +4 -4
  47. package/dist/utils/index.d.cts +2 -2
  48. package/dist/utils/index.d.ts +2 -2
  49. package/dist/utils/index.mjs +3 -3
  50. package/package.json +4 -4
  51. package/dist/chunk-AJWMPR7X.cjs.map +0 -1
  52. package/dist/chunk-FKI4OME5.mjs.map +0 -1
  53. package/dist/chunk-SZOX7K2V.cjs.map +0 -1
  54. package/dist/chunk-Z4D7ZWVB.mjs.map +0 -1
  55. /package/dist/{chunk-AC2BQSYP.mjs.map → chunk-DVJX76J3.mjs.map} +0 -0
  56. /package/dist/{chunk-LQXOM3TA.mjs.map → chunk-FG2CQGSE.mjs.map} +0 -0
  57. /package/dist/{chunk-26PADMXR.mjs.map → chunk-HQHXGWNJ.mjs.map} +0 -0
  58. /package/dist/{chunk-KBSFVKUB.mjs.map → chunk-ZGBFPD4O.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-GZ7HHI2D.cjs","../src/DelegationFramework/ERC20PeriodTransferEnforcer/index.ts","../src/DelegationFramework/ERC20PeriodTransferEnforcer/read.ts","../src/DelegationFramework/ERC20PeriodTransferEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/ERC20StreamingEnforcer/index.ts","../src/DelegationFramework/ERC20StreamingEnforcer/read.ts","../src/DelegationFramework/ERC20StreamingEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/index.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/read.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/index.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/read.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/index.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/read.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/methods/getAvailableAmount.ts"],"names":["read_exports","read","readContract","availableAmount","getBlock","getAvailableAmount"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,IAAA,oCAAA,EAAA,CAAA,CAAA;AAAA,wCAAA,mCAAA,EAAA;AAAA,EAAA,IAAA,EAAA,CAAA,EAAA,GAAA;AAAA,CAAA,CAAA;ADSA;AACA;AEVA,IAAA,aAAA,EAAA,CA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A;AAAA,IACA;AAAA,EACF,EAAA,EAAI,YAAA;AAGJ,EAAA,MAAM,gBAAA,EAAkBG,mBAAAA,CAAmB;AAAA,IACzC,aAAA,EAAe,oBAAA;AAAA,IACf,SAAA,EAAW,gBAAA;AAAA,IACX,eAAA,EAAiB,sBAAA;AAAA,IACjB,SAAA,EAAW,gBAAA;AAAA,IACX,KAAA,EAAO,EAAA;AAAA,IACP;AAAA,EACF,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL;AAAA,EACF,CAAA;AACF,CAAA;AAcA,SAASA,mBAAAA,CAAmB,SAAA,EAOjB;AAET,EAAA,GAAA,CAAI,SAAA,CAAU,iBAAA,EAAmB,SAAA,CAAU,SAAA,EAAW;AACpD,IAAA,OAAO,EAAA;AAAA,EACT;AAGA,EAAA,MAAM,QAAA,EAAU,SAAA,CAAU,iBAAA,EAAmB,SAAA,CAAU,SAAA;AAGvD,EAAA,IAAI,SAAA,EAAW,SAAA,CAAU,cAAA,EAAgB,SAAA,CAAU,gBAAA,EAAkB,OAAA;AAGrE,EAAA,GAAA,CAAI,SAAA,EAAW,SAAA,CAAU,SAAA,EAAW;AAClC,IAAA,SAAA,EAAW,SAAA,CAAU,SAAA;AAAA,EACvB;AAGA,EAAA,GAAA,CAAI,SAAA,CAAU,MAAA,GAAS,QAAA,EAAU;AAC/B,IAAA,OAAO,EAAA;AAAA,EACT;AAGA,EAAA,OAAO,SAAA,EAAW,SAAA,CAAU,KAAA;AAC9B;AfiKA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6lBAAC","file":"/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-GZ7HHI2D.cjs","sourcesContent":[null,"import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { ERC20PeriodTransferEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: ERC20PeriodTransferEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { ERC20StreamingEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract, getBlock } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n // Get current block timestamp from blockchain\n const currentBlock = await getBlock(client);\n const currentTimestamp = currentBlock.timestamp;\n\n // First, get the current state from the contract\n const allowanceState = await readContract(client, {\n address: contractAddress,\n abi: ERC20StreamingEnforcer,\n functionName: 'streamingAllowances',\n args: [delegationManager, delegationHash],\n });\n\n const [initialAmount, maxAmount, amountPerSecond, startTime, spent] =\n allowanceState;\n\n // Check if state exists (startTime != 0)\n if (startTime !== 0n) {\n // State exists, calculate available amount using the stored state\n const availableAmount = getAvailableAmount({\n initialAmount,\n maxAmount,\n amountPerSecond,\n startTime,\n spent,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n }\n\n // State doesn't exist, decode terms and simulate with spent = 0\n const decodedTerms = await readContract(client, {\n address: contractAddress,\n abi: ERC20StreamingEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n const [\n ,\n decodedInitialAmount,\n decodedMaxAmount,\n decodedAmountPerSecond,\n decodedStartTime,\n ] = decodedTerms;\n\n // Simulate using decoded terms with spent = 0\n const availableAmount = getAvailableAmount({\n initialAmount: decodedInitialAmount,\n maxAmount: decodedMaxAmount,\n amountPerSecond: decodedAmountPerSecond,\n startTime: decodedStartTime,\n spent: 0n,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n};\n\n/**\n * Replicates the internal _getAvailableAmount logic from the smart contract.\n *\n * @param allowance - The allowance object containing all parameters.\n * @param allowance.initialAmount - The initial amount available.\n * @param allowance.maxAmount - The maximum amount allowed.\n * @param allowance.amountPerSecond - The amount streamed per second.\n * @param allowance.startTime - The start time of the streaming.\n * @param allowance.spent - The amount already spent.\n * @param allowance.currentTimestamp - The current timestamp.\n * @returns The available amount that can be spent.\n */\nfunction getAvailableAmount(allowance: {\n initialAmount: bigint;\n maxAmount: bigint;\n amountPerSecond: bigint;\n startTime: bigint;\n spent: bigint;\n currentTimestamp: bigint;\n}): bigint {\n // If current time is before start time, nothing is available\n if (allowance.currentTimestamp < allowance.startTime) {\n return 0n;\n }\n\n // Calculate elapsed time since start\n const elapsed = allowance.currentTimestamp - allowance.startTime;\n\n // Calculate total unlocked amount\n let unlocked = allowance.initialAmount + allowance.amountPerSecond * elapsed;\n\n // Cap by max amount\n if (unlocked > allowance.maxAmount) {\n unlocked = allowance.maxAmount;\n }\n\n // If spent >= unlocked, nothing available\n if (allowance.spent >= unlocked) {\n return 0n;\n }\n\n // Return available amount\n return unlocked - allowance.spent;\n}\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { MultiTokenPeriodEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n args: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n args,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: MultiTokenPeriodEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms, args],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { NativeTokenPeriodTransferEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: NativeTokenPeriodTransferEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { NativeTokenStreamingEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract, getBlock } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n // Get current block timestamp from blockchain\n const currentBlock = await getBlock(client);\n const currentTimestamp = currentBlock.timestamp;\n\n // First, get the current state from the contract\n const allowanceState = await readContract(client, {\n address: contractAddress,\n abi: NativeTokenStreamingEnforcer,\n functionName: 'streamingAllowances',\n args: [delegationManager, delegationHash],\n });\n\n const [initialAmount, maxAmount, amountPerSecond, startTime, spent] =\n allowanceState;\n\n // Check if state exists (startTime != 0)\n if (startTime !== 0n) {\n // State exists, calculate available amount using the stored state\n const availableAmount = getAvailableAmount({\n initialAmount,\n maxAmount,\n amountPerSecond,\n startTime,\n spent,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n }\n\n // State doesn't exist, decode terms and simulate with spent = 0\n const decodedTerms = await readContract(client, {\n address: contractAddress,\n abi: NativeTokenStreamingEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n const [\n decodedInitialAmount,\n decodedMaxAmount,\n decodedAmountPerSecond,\n decodedStartTime,\n ] = decodedTerms;\n\n // Simulate using decoded terms with spent = 0\n const availableAmount = getAvailableAmount({\n initialAmount: decodedInitialAmount,\n maxAmount: decodedMaxAmount,\n amountPerSecond: decodedAmountPerSecond,\n startTime: decodedStartTime,\n spent: 0n,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n};\n\n/**\n * Replicates the internal _getAvailableAmount logic from the smart contract.\n *\n * @param allowance - The allowance object containing all parameters.\n * @param allowance.initialAmount - The initial amount available.\n * @param allowance.maxAmount - The maximum amount allowed.\n * @param allowance.amountPerSecond - The amount streamed per second.\n * @param allowance.startTime - The start time of the streaming.\n * @param allowance.spent - The amount already spent.\n * @param allowance.currentTimestamp - The current timestamp.\n * @returns The available amount that can be spent.\n */\nfunction getAvailableAmount(allowance: {\n initialAmount: bigint;\n maxAmount: bigint;\n amountPerSecond: bigint;\n startTime: bigint;\n spent: bigint;\n currentTimestamp: bigint;\n}): bigint {\n // If current time is before start time, nothing is available\n if (allowance.currentTimestamp < allowance.startTime) {\n return 0n;\n }\n\n // Calculate elapsed time since start\n const elapsed = allowance.currentTimestamp - allowance.startTime;\n\n // Calculate total unlocked amount\n let unlocked = allowance.initialAmount + allowance.amountPerSecond * elapsed;\n\n // Cap by max amount\n if (unlocked > allowance.maxAmount) {\n unlocked = allowance.maxAmount;\n }\n\n // If spent >= unlocked, nothing available\n if (allowance.spent >= unlocked) {\n return 0n;\n }\n\n // Return available amount\n return unlocked - allowance.spent;\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-XZ7UMCG3.cjs","../src/DelegationFramework/ERC20PeriodTransferEnforcer/index.ts","../src/DelegationFramework/ERC20PeriodTransferEnforcer/read.ts","../src/DelegationFramework/ERC20PeriodTransferEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/ERC20StreamingEnforcer/index.ts","../src/DelegationFramework/ERC20StreamingEnforcer/read.ts","../src/DelegationFramework/ERC20StreamingEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/index.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/read.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/index.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/read.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/index.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/read.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/methods/getAvailableAmount.ts"],"names":["read_exports","read","readContract","availableAmount","getBlock","getAvailableAmount"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,IAAA,oCAAA,EAAA,CAAA,CAAA;AAAA,wCAAA,mCAAA,EAAA;AAAA,EAAA,IAAA,EAAA,CAAA,EAAA,GAAA;AAAA,CAAA,CAAA;ADSA;AACA;AEVA,IAAA,aAAA,EAAA,CAAA,CAAA;AAAA,wCAAA,YAAA,EAAA;A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YAAA;AAGJ,EAAA,MAAM,gBAAA,EAAkBG,mBAAAA,CAAmB;AAAA,IACzC,aAAA,EAAe,oBAAA;AAAA,IACf,SAAA,EAAW,gBAAA;AAAA,IACX,eAAA,EAAiB,sBAAA;AAAA,IACjB,SAAA,EAAW,gBAAA;AAAA,IACX,KAAA,EAAO,EAAA;AAAA,IACP;AAAA,EACF,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL;AAAA,EACF,CAAA;AACF,CAAA;AAcA,SAASA,mBAAAA,CAAmB,SAAA,EAOjB;AAET,EAAA,GAAA,CAAI,SAAA,CAAU,iBAAA,EAAmB,SAAA,CAAU,SAAA,EAAW;AACpD,IAAA,OAAO,EAAA;AAAA,EACT;AAGA,EAAA,MAAM,QAAA,EAAU,SAAA,CAAU,iBAAA,EAAmB,SAAA,CAAU,SAAA;AAGvD,EAAA,IAAI,SAAA,EAAW,SAAA,CAAU,cAAA,EAAgB,SAAA,CAAU,gBAAA,EAAkB,OAAA;AAGrE,EAAA,GAAA,CAAI,SAAA,EAAW,SAAA,CAAU,SAAA,EAAW;AAClC,IAAA,SAAA,EAAW,SAAA,CAAU,SAAA;AAAA,EACvB;AAGA,EAAA,GAAA,CAAI,SAAA,CAAU,MAAA,GAAS,QAAA,EAAU;AAC/B,IAAA,OAAO,EAAA;AAAA,EACT;AAGA,EAAA,OAAO,SAAA,EAAW,SAAA,CAAU,KAAA;AAC9B;AfiKA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6lBAAC","file":"/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-XZ7UMCG3.cjs","sourcesContent":[null,"import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { ERC20PeriodTransferEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: ERC20PeriodTransferEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { ERC20StreamingEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract, getBlock } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n // Get current block timestamp from blockchain\n const currentBlock = await getBlock(client);\n const currentTimestamp = currentBlock.timestamp;\n\n // First, get the current state from the contract\n const allowanceState = await readContract(client, {\n address: contractAddress,\n abi: ERC20StreamingEnforcer,\n functionName: 'streamingAllowances',\n args: [delegationManager, delegationHash],\n });\n\n const [initialAmount, maxAmount, amountPerSecond, startTime, spent] =\n allowanceState;\n\n // Check if state exists (startTime != 0)\n if (startTime !== 0n) {\n // State exists, calculate available amount using the stored state\n const availableAmount = getAvailableAmount({\n initialAmount,\n maxAmount,\n amountPerSecond,\n startTime,\n spent,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n }\n\n // State doesn't exist, decode terms and simulate with spent = 0\n const decodedTerms = await readContract(client, {\n address: contractAddress,\n abi: ERC20StreamingEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n const [\n ,\n decodedInitialAmount,\n decodedMaxAmount,\n decodedAmountPerSecond,\n decodedStartTime,\n ] = decodedTerms;\n\n // Simulate using decoded terms with spent = 0\n const availableAmount = getAvailableAmount({\n initialAmount: decodedInitialAmount,\n maxAmount: decodedMaxAmount,\n amountPerSecond: decodedAmountPerSecond,\n startTime: decodedStartTime,\n spent: 0n,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n};\n\n/**\n * Replicates the internal _getAvailableAmount logic from the smart contract.\n *\n * @param allowance - The allowance object containing all parameters.\n * @param allowance.initialAmount - The initial amount available.\n * @param allowance.maxAmount - The maximum amount allowed.\n * @param allowance.amountPerSecond - The amount streamed per second.\n * @param allowance.startTime - The start time of the streaming.\n * @param allowance.spent - The amount already spent.\n * @param allowance.currentTimestamp - The current timestamp.\n * @returns The available amount that can be spent.\n */\nfunction getAvailableAmount(allowance: {\n initialAmount: bigint;\n maxAmount: bigint;\n amountPerSecond: bigint;\n startTime: bigint;\n spent: bigint;\n currentTimestamp: bigint;\n}): bigint {\n // If current time is before start time, nothing is available\n if (allowance.currentTimestamp < allowance.startTime) {\n return 0n;\n }\n\n // Calculate elapsed time since start\n const elapsed = allowance.currentTimestamp - allowance.startTime;\n\n // Calculate total unlocked amount\n let unlocked = allowance.initialAmount + allowance.amountPerSecond * elapsed;\n\n // Cap by max amount\n if (unlocked > allowance.maxAmount) {\n unlocked = allowance.maxAmount;\n }\n\n // If spent >= unlocked, nothing available\n if (allowance.spent >= unlocked) {\n return 0n;\n }\n\n // Return available amount\n return unlocked - allowance.spent;\n}\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { MultiTokenPeriodEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n args: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n args,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: MultiTokenPeriodEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms, args],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { NativeTokenPeriodTransferEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: NativeTokenPeriodTransferEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { NativeTokenStreamingEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract, getBlock } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n // Get current block timestamp from blockchain\n const currentBlock = await getBlock(client);\n const currentTimestamp = currentBlock.timestamp;\n\n // First, get the current state from the contract\n const allowanceState = await readContract(client, {\n address: contractAddress,\n abi: NativeTokenStreamingEnforcer,\n functionName: 'streamingAllowances',\n args: [delegationManager, delegationHash],\n });\n\n const [initialAmount, maxAmount, amountPerSecond, startTime, spent] =\n allowanceState;\n\n // Check if state exists (startTime != 0)\n if (startTime !== 0n) {\n // State exists, calculate available amount using the stored state\n const availableAmount = getAvailableAmount({\n initialAmount,\n maxAmount,\n amountPerSecond,\n startTime,\n spent,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n }\n\n // State doesn't exist, decode terms and simulate with spent = 0\n const decodedTerms = await readContract(client, {\n address: contractAddress,\n abi: NativeTokenStreamingEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n const [\n decodedInitialAmount,\n decodedMaxAmount,\n decodedAmountPerSecond,\n decodedStartTime,\n ] = decodedTerms;\n\n // Simulate using decoded terms with spent = 0\n const availableAmount = getAvailableAmount({\n initialAmount: decodedInitialAmount,\n maxAmount: decodedMaxAmount,\n amountPerSecond: decodedAmountPerSecond,\n startTime: decodedStartTime,\n spent: 0n,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n};\n\n/**\n * Replicates the internal _getAvailableAmount logic from the smart contract.\n *\n * @param allowance - The allowance object containing all parameters.\n * @param allowance.initialAmount - The initial amount available.\n * @param allowance.maxAmount - The maximum amount allowed.\n * @param allowance.amountPerSecond - The amount streamed per second.\n * @param allowance.startTime - The start time of the streaming.\n * @param allowance.spent - The amount already spent.\n * @param allowance.currentTimestamp - The current timestamp.\n * @returns The available amount that can be spent.\n */\nfunction getAvailableAmount(allowance: {\n initialAmount: bigint;\n maxAmount: bigint;\n amountPerSecond: bigint;\n startTime: bigint;\n spent: bigint;\n currentTimestamp: bigint;\n}): bigint {\n // If current time is before start time, nothing is available\n if (allowance.currentTimestamp < allowance.startTime) {\n return 0n;\n }\n\n // Calculate elapsed time since start\n const elapsed = allowance.currentTimestamp - allowance.startTime;\n\n // Calculate total unlocked amount\n let unlocked = allowance.initialAmount + allowance.amountPerSecond * elapsed;\n\n // Cap by max amount\n if (unlocked > allowance.maxAmount) {\n unlocked = allowance.maxAmount;\n }\n\n // If spent >= unlocked, nothing available\n if (allowance.spent >= unlocked) {\n return 0n;\n }\n\n // Return available amount\n return unlocked - allowance.spent;\n}\n"]}
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  __export,
6
6
  toDelegationStruct
7
- } from "./chunk-Z4D7ZWVB.mjs";
7
+ } from "./chunk-EEIIVBNV.mjs";
8
8
 
9
9
  // src/DelegationFramework/utils.ts
10
10
  import { ERC1967Proxy } from "@metamask/delegation-abis";
@@ -827,4 +827,4 @@ export {
827
827
  execute6,
828
828
  encode_exports4
829
829
  };
830
- //# sourceMappingURL=chunk-KBSFVKUB.mjs.map
830
+ //# sourceMappingURL=chunk-ZGBFPD4O.mjs.map
@@ -14,21 +14,21 @@
14
14
 
15
15
 
16
16
 
17
- var _chunk57I2FJY7cjs = require('../chunk-57I2FJY7.cjs');
17
+ var _chunkRR2AMG4Acjs = require('../chunk-RR2AMG4A.cjs');
18
18
 
19
19
 
20
20
 
21
21
 
22
22
 
23
23
 
24
- var _chunkGZ7HHI2Dcjs = require('../chunk-GZ7HHI2D.cjs');
24
+ var _chunkXZ7UMCG3cjs = require('../chunk-XZ7UMCG3.cjs');
25
25
 
26
26
 
27
27
 
28
28
 
29
- var _chunkDLCTHNAEcjs = require('../chunk-DLCTHNAE.cjs');
29
+ var _chunkSO5JAXGDcjs = require('../chunk-SO5JAXGD.cjs');
30
30
  require('../chunk-MOHCTPYQ.cjs');
31
- require('../chunk-SZOX7K2V.cjs');
31
+ require('../chunk-TMO23YRP.cjs');
32
32
 
33
33
 
34
34
 
@@ -53,5 +53,5 @@ require('../chunk-SZOX7K2V.cjs');
53
53
 
54
54
 
55
55
 
56
- exports.DeleGatorCore = _chunk57I2FJY7cjs.DeleGatorCore_exports; exports.DelegationManager = _chunk57I2FJY7cjs.DelegationManager_exports; exports.EIP712 = _chunk57I2FJY7cjs.EIP712_exports; exports.ERC20PeriodTransferEnforcer = _chunkGZ7HHI2Dcjs.ERC20PeriodTransferEnforcer_exports; exports.ERC20StreamingEnforcer = _chunkGZ7HHI2Dcjs.ERC20StreamingEnforcer_exports; exports.ERC20TransferAmountEnforcer = _chunk57I2FJY7cjs.ERC20TransferAmountEnforcer_exports; exports.EntryPoint = _chunk57I2FJY7cjs.EntryPoint_exports; exports.HybridDeleGator = _chunk57I2FJY7cjs.HybridDeleGator_exports; exports.IdEnforcer = _chunk57I2FJY7cjs.IdEnforcer_exports; exports.LimitedCallsEnforcer = _chunk57I2FJY7cjs.LimitedCallsEnforcer_exports; exports.MultiSigDeleGator = _chunk57I2FJY7cjs.MultiSigDeleGator_exports; exports.MultiTokenPeriodEnforcer = _chunkGZ7HHI2Dcjs.MultiTokenPeriodEnforcer_exports; exports.NativeTokenPeriodTransferEnforcer = _chunkGZ7HHI2Dcjs.NativeTokenPeriodTransferEnforcer_exports; exports.NativeTokenStreamingEnforcer = _chunkGZ7HHI2Dcjs.NativeTokenStreamingEnforcer_exports; exports.NativeTokenTransferAmountEnforcer = _chunk57I2FJY7cjs.NativeTokenTransferAmountEnforcer_exports; exports.NonceEnforcer = _chunk57I2FJY7cjs.NonceEnforcer_exports; exports.Ownable2Step = _chunk57I2FJY7cjs.Ownable2Step_exports; exports.Pausable = _chunk57I2FJY7cjs.Pausable_exports; exports.SimpleFactory = _chunk57I2FJY7cjs.SimpleFactory_exports; exports.SpecificActionERC20TransferBatchEnforcer = _chunk57I2FJY7cjs.SpecificActionERC20TransferBatchEnforcer_exports; exports.encodeProxyCreationCode = _chunkDLCTHNAEcjs.encodeProxyCreationCode; exports.isContractDeployed = _chunkDLCTHNAEcjs.isContractDeployed; exports.isImplementationExpected = _chunkDLCTHNAEcjs.isImplementationExpected;
56
+ exports.DeleGatorCore = _chunkRR2AMG4Acjs.DeleGatorCore_exports; exports.DelegationManager = _chunkRR2AMG4Acjs.DelegationManager_exports; exports.EIP712 = _chunkRR2AMG4Acjs.EIP712_exports; exports.ERC20PeriodTransferEnforcer = _chunkXZ7UMCG3cjs.ERC20PeriodTransferEnforcer_exports; exports.ERC20StreamingEnforcer = _chunkXZ7UMCG3cjs.ERC20StreamingEnforcer_exports; exports.ERC20TransferAmountEnforcer = _chunkRR2AMG4Acjs.ERC20TransferAmountEnforcer_exports; exports.EntryPoint = _chunkRR2AMG4Acjs.EntryPoint_exports; exports.HybridDeleGator = _chunkRR2AMG4Acjs.HybridDeleGator_exports; exports.IdEnforcer = _chunkRR2AMG4Acjs.IdEnforcer_exports; exports.LimitedCallsEnforcer = _chunkRR2AMG4Acjs.LimitedCallsEnforcer_exports; exports.MultiSigDeleGator = _chunkRR2AMG4Acjs.MultiSigDeleGator_exports; exports.MultiTokenPeriodEnforcer = _chunkXZ7UMCG3cjs.MultiTokenPeriodEnforcer_exports; exports.NativeTokenPeriodTransferEnforcer = _chunkXZ7UMCG3cjs.NativeTokenPeriodTransferEnforcer_exports; exports.NativeTokenStreamingEnforcer = _chunkXZ7UMCG3cjs.NativeTokenStreamingEnforcer_exports; exports.NativeTokenTransferAmountEnforcer = _chunkRR2AMG4Acjs.NativeTokenTransferAmountEnforcer_exports; exports.NonceEnforcer = _chunkRR2AMG4Acjs.NonceEnforcer_exports; exports.Ownable2Step = _chunkRR2AMG4Acjs.Ownable2Step_exports; exports.Pausable = _chunkRR2AMG4Acjs.Pausable_exports; exports.SimpleFactory = _chunkRR2AMG4Acjs.SimpleFactory_exports; exports.SpecificActionERC20TransferBatchEnforcer = _chunkRR2AMG4Acjs.SpecificActionERC20TransferBatchEnforcer_exports; exports.encodeProxyCreationCode = _chunkSO5JAXGDcjs.encodeProxyCreationCode; exports.isContractDeployed = _chunkSO5JAXGDcjs.isContractDeployed; exports.isImplementationExpected = _chunkSO5JAXGDcjs.isImplementationExpected;
57
57
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
- export { a as DeleGatorCore, b as DelegationManager, c as EIP712, d as ERC20PeriodTransferEnforcer, e as ERC20StreamingEnforcer, f as ERC20TransferAmountEnforcer, g as EntryPoint, h as HybridDeleGator, j as IdEnforcer, I as InitializedClient, k as LimitedCallsEnforcer, l as MultiSigDeleGator, m as MultiTokenPeriodEnforcer, n as NativeTokenPeriodTransferEnforcer, o as NativeTokenStreamingEnforcer, p as NativeTokenTransferAmountEnforcer, q as NonceEnforcer, r as Ownable2Step, P as P256Owner, s as Pausable, t as SimpleFactory, u as SpecificActionERC20TransferBatchEnforcer, v as encodeProxyCreationCode, w as isContractDeployed, x as isImplementationExpected } from '../index-DE87r5KY.cjs';
1
+ export { a as DeleGatorCore, b as DelegationManager, c as EIP712, d as ERC20PeriodTransferEnforcer, e as ERC20StreamingEnforcer, f as ERC20TransferAmountEnforcer, g as EntryPoint, h as HybridDeleGator, j as IdEnforcer, I as InitializedClient, k as LimitedCallsEnforcer, l as MultiSigDeleGator, m as MultiTokenPeriodEnforcer, n as NativeTokenPeriodTransferEnforcer, o as NativeTokenStreamingEnforcer, p as NativeTokenTransferAmountEnforcer, q as NonceEnforcer, r as Ownable2Step, P as P256Owner, s as Pausable, t as SimpleFactory, u as SpecificActionERC20TransferBatchEnforcer, v as encodeProxyCreationCode, w as isContractDeployed, x as isImplementationExpected } from '../index-DzL9ccjU.cjs';
2
2
  import '@metamask/delegation-core';
3
3
  import 'viem';
4
- import '../delegation-KbWHzRxV.cjs';
4
+ import '../delegation-DoVULGYE.cjs';
5
5
  import '../types-BWaH4KH1.cjs';
6
6
  import '@metamask/delegation-abis';
7
7
  import 'viem/account-abstraction';
@@ -1,7 +1,7 @@
1
- export { a as DeleGatorCore, b as DelegationManager, c as EIP712, d as ERC20PeriodTransferEnforcer, e as ERC20StreamingEnforcer, f as ERC20TransferAmountEnforcer, g as EntryPoint, h as HybridDeleGator, j as IdEnforcer, I as InitializedClient, k as LimitedCallsEnforcer, l as MultiSigDeleGator, m as MultiTokenPeriodEnforcer, n as NativeTokenPeriodTransferEnforcer, o as NativeTokenStreamingEnforcer, p as NativeTokenTransferAmountEnforcer, q as NonceEnforcer, r as Ownable2Step, P as P256Owner, s as Pausable, t as SimpleFactory, u as SpecificActionERC20TransferBatchEnforcer, v as encodeProxyCreationCode, w as isContractDeployed, x as isImplementationExpected } from '../index-D2THBlfm.js';
1
+ export { a as DeleGatorCore, b as DelegationManager, c as EIP712, d as ERC20PeriodTransferEnforcer, e as ERC20StreamingEnforcer, f as ERC20TransferAmountEnforcer, g as EntryPoint, h as HybridDeleGator, j as IdEnforcer, I as InitializedClient, k as LimitedCallsEnforcer, l as MultiSigDeleGator, m as MultiTokenPeriodEnforcer, n as NativeTokenPeriodTransferEnforcer, o as NativeTokenStreamingEnforcer, p as NativeTokenTransferAmountEnforcer, q as NonceEnforcer, r as Ownable2Step, P as P256Owner, s as Pausable, t as SimpleFactory, u as SpecificActionERC20TransferBatchEnforcer, v as encodeProxyCreationCode, w as isContractDeployed, x as isImplementationExpected } from '../index-DRKgDSZW.js';
2
2
  import '@metamask/delegation-core';
3
3
  import 'viem';
4
- import '../delegation-Bx4FEAIU.js';
4
+ import '../delegation-CR99q1-n.js';
5
5
  import '../types-BWaH4KH1.js';
6
6
  import '@metamask/delegation-abis';
7
7
  import 'viem/account-abstraction';
@@ -14,21 +14,21 @@ import {
14
14
  Pausable_exports,
15
15
  SimpleFactory_exports,
16
16
  SpecificActionERC20TransferBatchEnforcer_exports
17
- } from "../chunk-26PADMXR.mjs";
17
+ } from "../chunk-HQHXGWNJ.mjs";
18
18
  import {
19
19
  ERC20PeriodTransferEnforcer_exports,
20
20
  ERC20StreamingEnforcer_exports,
21
21
  MultiTokenPeriodEnforcer_exports,
22
22
  NativeTokenPeriodTransferEnforcer_exports,
23
23
  NativeTokenStreamingEnforcer_exports
24
- } from "../chunk-AC2BQSYP.mjs";
24
+ } from "../chunk-DVJX76J3.mjs";
25
25
  import {
26
26
  encodeProxyCreationCode,
27
27
  isContractDeployed,
28
28
  isImplementationExpected
29
- } from "../chunk-KBSFVKUB.mjs";
29
+ } from "../chunk-ZGBFPD4O.mjs";
30
30
  import "../chunk-4QXIOE7F.mjs";
31
- import "../chunk-Z4D7ZWVB.mjs";
31
+ import "../chunk-EEIIVBNV.mjs";
32
32
  export {
33
33
  DeleGatorCore_exports as DeleGatorCore,
34
34
  DelegationManager_exports as DelegationManager,
@@ -1,5 +1,6 @@
1
1
  import { Hex, AbiFunction, Address, AbiParameter, TypedData } from 'viem';
2
2
  import { S as SmartAccountsEnvironment, C as Caveat, b as CaveatType, g as ScopeType, D as Delegation, P as PermissionContext } from './types-BWaH4KH1.js';
3
+ import { BalanceChangeType } from '@metamask/delegation-core';
3
4
 
4
5
  type AllowedCalldataBuilderConfig = {
5
6
  startIndex: number;
@@ -54,11 +55,6 @@ type DeployedBuilderConfig = {
54
55
  };
55
56
  declare const deployedBuilder: (environment: SmartAccountsEnvironment, config: DeployedBuilderConfig) => Caveat;
56
57
 
57
- declare enum BalanceChangeType {
58
- Increase = 0,
59
- Decrease = 1
60
- }
61
-
62
58
  type Erc1155BalanceChangeBuilderConfig = {
63
59
  tokenAddress: Address;
64
60
  recipient: Address;
@@ -399,4 +395,4 @@ declare const signDelegation: ({ privateKey, delegation, delegationManager, chai
399
395
  allowInsecureUnrestrictedDelegation?: boolean;
400
396
  }) => Promise<`0x${string}`>;
401
397
 
402
- export { type CoreCaveatConfiguration as A, BalanceChangeType as B, type Caveats as C, DELEGATION_ABI_TYPE as D, ExecutionMode as E, SIGNABLE_DELEGATION_TYPED_DATA as S, type CreateDelegationOptions as a, type CreateExecutionArgs as b, type CreateOpenDelegationOptions as c, type ExecutionStruct as d, createDelegation as e, createExecution as f, createOpenDelegation as g, CaveatBuilder as h, type CaveatBuilderConfig as i, type CoreCaveatBuilder as j, DELEGATION_ABI_TYPE_COMPONENTS as k, DELEGATION_ARRAY_ABI_TYPE as l, type DelegationStruct as m, createCaveatBuilder as n, decodeDelegation as o, decodeDelegations as p, encodeBatchExecution as q, encodeDelegation as r, signDelegation as s, encodeDelegations as t, encodeExecutionCalldata as u, encodeExecutionCalldatas as v, encodeSingleExecution as w, hashDelegation as x, toDelegation as y, toDelegationStruct as z };
398
+ export { type CoreCaveatConfiguration as A, type Caveats as C, DELEGATION_ABI_TYPE as D, ExecutionMode as E, SIGNABLE_DELEGATION_TYPED_DATA as S, type CreateDelegationOptions as a, type CreateExecutionArgs as b, type CreateOpenDelegationOptions as c, type ExecutionStruct as d, createDelegation as e, createExecution as f, createOpenDelegation as g, CaveatBuilder as h, type CaveatBuilderConfig as i, type CoreCaveatBuilder as j, DELEGATION_ABI_TYPE_COMPONENTS as k, DELEGATION_ARRAY_ABI_TYPE as l, type DelegationStruct as m, createCaveatBuilder as n, decodeDelegation as o, decodeDelegations as p, encodeBatchExecution as q, encodeDelegation as r, signDelegation as s, encodeDelegations as t, encodeExecutionCalldata as u, encodeExecutionCalldatas as v, encodeSingleExecution as w, hashDelegation as x, toDelegation as y, toDelegationStruct as z };
@@ -1,5 +1,6 @@
1
1
  import { Hex, AbiFunction, Address, AbiParameter, TypedData } from 'viem';
2
2
  import { S as SmartAccountsEnvironment, C as Caveat, b as CaveatType, g as ScopeType, D as Delegation, P as PermissionContext } from './types-BWaH4KH1.cjs';
3
+ import { BalanceChangeType } from '@metamask/delegation-core';
3
4
 
4
5
  type AllowedCalldataBuilderConfig = {
5
6
  startIndex: number;
@@ -54,11 +55,6 @@ type DeployedBuilderConfig = {
54
55
  };
55
56
  declare const deployedBuilder: (environment: SmartAccountsEnvironment, config: DeployedBuilderConfig) => Caveat;
56
57
 
57
- declare enum BalanceChangeType {
58
- Increase = 0,
59
- Decrease = 1
60
- }
61
-
62
58
  type Erc1155BalanceChangeBuilderConfig = {
63
59
  tokenAddress: Address;
64
60
  recipient: Address;
@@ -399,4 +395,4 @@ declare const signDelegation: ({ privateKey, delegation, delegationManager, chai
399
395
  allowInsecureUnrestrictedDelegation?: boolean;
400
396
  }) => Promise<`0x${string}`>;
401
397
 
402
- export { type CoreCaveatConfiguration as A, BalanceChangeType as B, type Caveats as C, DELEGATION_ABI_TYPE as D, ExecutionMode as E, SIGNABLE_DELEGATION_TYPED_DATA as S, type CreateDelegationOptions as a, type CreateExecutionArgs as b, type CreateOpenDelegationOptions as c, type ExecutionStruct as d, createDelegation as e, createExecution as f, createOpenDelegation as g, CaveatBuilder as h, type CaveatBuilderConfig as i, type CoreCaveatBuilder as j, DELEGATION_ABI_TYPE_COMPONENTS as k, DELEGATION_ARRAY_ABI_TYPE as l, type DelegationStruct as m, createCaveatBuilder as n, decodeDelegation as o, decodeDelegations as p, encodeBatchExecution as q, encodeDelegation as r, signDelegation as s, encodeDelegations as t, encodeExecutionCalldata as u, encodeExecutionCalldatas as v, encodeSingleExecution as w, hashDelegation as x, toDelegation as y, toDelegationStruct as z };
398
+ export { type CoreCaveatConfiguration as A, type Caveats as C, DELEGATION_ABI_TYPE as D, ExecutionMode as E, SIGNABLE_DELEGATION_TYPED_DATA as S, type CreateDelegationOptions as a, type CreateExecutionArgs as b, type CreateOpenDelegationOptions as c, type ExecutionStruct as d, createDelegation as e, createExecution as f, createOpenDelegation as g, CaveatBuilder as h, type CaveatBuilderConfig as i, type CoreCaveatBuilder as j, DELEGATION_ABI_TYPE_COMPONENTS as k, DELEGATION_ARRAY_ABI_TYPE as l, type DelegationStruct as m, createCaveatBuilder as n, decodeDelegation as o, decodeDelegations as p, encodeBatchExecution as q, encodeDelegation as r, signDelegation as s, encodeDelegations as t, encodeExecutionCalldata as u, encodeExecutionCalldatas as v, encodeSingleExecution as w, hashDelegation as x, toDelegation as y, toDelegationStruct as z };
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkSZOX7K2Vcjs = require('../chunk-SZOX7K2V.cjs');
4
+ var _chunkTMO23YRPcjs = require('../chunk-TMO23YRP.cjs');
5
5
 
6
6
  // src/experimental/delegationStorage.ts
7
7
  var _viem = require('viem');
@@ -22,7 +22,7 @@ var DelegationStorageClient = class {
22
22
  #apiUrl;
23
23
  constructor(config) {
24
24
  const { apiUrl } = config.environment;
25
- _chunkSZOX7K2Vcjs.trackSmartAccountsKitFunctionCall.call(void 0,
25
+ _chunkTMO23YRPcjs.trackSmartAccountsKitFunctionCall.call(void 0,
26
26
  "experimental.DelegationStorageClient.constructor",
27
27
  {
28
28
  environment: getDelegationStorageEnvironment(apiUrl)
@@ -68,13 +68,13 @@ var DelegationStorageClient = class {
68
68
  * is not found.
69
69
  */
70
70
  async getDelegationChain(leafDelegationOrDelegationHash) {
71
- _chunkSZOX7K2Vcjs.trackSmartAccountsKitFunctionCall.call(void 0,
71
+ _chunkTMO23YRPcjs.trackSmartAccountsKitFunctionCall.call(void 0,
72
72
  "experimental.DelegationStorageClient.getDelegationChain",
73
73
  {
74
74
  inputKind: typeof leafDelegationOrDelegationHash === "string" ? "hash" : "delegation"
75
75
  }
76
76
  );
77
- const leafDelegationHash = typeof leafDelegationOrDelegationHash === "string" ? leafDelegationOrDelegationHash : _chunkSZOX7K2Vcjs.hashDelegation.call(void 0, leafDelegationOrDelegationHash);
77
+ const leafDelegationHash = typeof leafDelegationOrDelegationHash === "string" ? leafDelegationOrDelegationHash : _chunkTMO23YRPcjs.hashDelegation.call(void 0, leafDelegationOrDelegationHash);
78
78
  const response = await this.#fetcher(
79
79
  `${this.#apiUrl}/delegation/chain/${leafDelegationHash}`,
80
80
  {
@@ -104,7 +104,7 @@ var DelegationStorageClient = class {
104
104
  * empty array if the delegations are not found.
105
105
  */
106
106
  async fetchDelegations(deleGatorAddress, filterMode = "RECEIVED" /* Received */) {
107
- _chunkSZOX7K2Vcjs.trackSmartAccountsKitFunctionCall.call(void 0,
107
+ _chunkTMO23YRPcjs.trackSmartAccountsKitFunctionCall.call(void 0,
108
108
  "experimental.DelegationStorageClient.fetchDelegations",
109
109
  { filterMode }
110
110
  );
@@ -131,14 +131,14 @@ var DelegationStorageClient = class {
131
131
  * @returns A promise that resolves to the delegation hash indicating successful storage.
132
132
  */
133
133
  async storeDelegation(delegation) {
134
- _chunkSZOX7K2Vcjs.trackSmartAccountsKitFunctionCall.call(void 0,
134
+ _chunkTMO23YRPcjs.trackSmartAccountsKitFunctionCall.call(void 0,
135
135
  "experimental.DelegationStorageClient.storeDelegation",
136
136
  { caveatCount: delegation.caveats.length }
137
137
  );
138
138
  if (!delegation.signature || delegation.signature === "0x") {
139
139
  throw new Error("Delegation must be signed to be stored");
140
140
  }
141
- const delegationHash = _chunkSZOX7K2Vcjs.hashDelegation.call(void 0, delegation);
141
+ const delegationHash = _chunkTMO23YRPcjs.hashDelegation.call(void 0, delegation);
142
142
  const body = JSON.stringify(
143
143
  {
144
144
  ...delegation,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  hashDelegation,
3
3
  trackSmartAccountsKitFunctionCall
4
- } from "../chunk-Z4D7ZWVB.mjs";
4
+ } from "../chunk-EEIIVBNV.mjs";
5
5
 
6
6
  // src/experimental/delegationStorage.ts
7
7
  import { toHex } from "viem";
@@ -49,13 +49,30 @@ type Erc20TokenPeriodicPermission = BasePermission & {
49
49
  justification?: string;
50
50
  };
51
51
  };
52
+ type NativeTokenAllowancePermission = BasePermission & {
53
+ type: 'native-token-allowance';
54
+ data: {
55
+ allowanceAmount: bigint;
56
+ startTime?: number;
57
+ justification?: string;
58
+ };
59
+ };
60
+ type Erc20TokenAllowancePermission = BasePermission & {
61
+ type: 'erc20-token-allowance';
62
+ data: {
63
+ allowanceAmount: bigint;
64
+ startTime?: number;
65
+ tokenAddress: Address;
66
+ justification?: string;
67
+ };
68
+ };
52
69
  type Erc20TokenRevocationPermission = BasePermission & {
53
70
  type: 'erc20-token-revocation';
54
71
  data: {
55
72
  justification?: string;
56
73
  };
57
74
  };
58
- type PermissionTypes = NativeTokenStreamPermission | NativeTokenPeriodicPermission | Erc20TokenStreamPermission | Erc20TokenPeriodicPermission | Erc20TokenRevocationPermission;
75
+ type PermissionTypes = NativeTokenStreamPermission | NativeTokenPeriodicPermission | NativeTokenAllowancePermission | Erc20TokenStreamPermission | Erc20TokenPeriodicPermission | Erc20TokenAllowancePermission | Erc20TokenRevocationPermission;
59
76
  type PermissionRequestParameter = {
60
77
  chainId: number;
61
78
  permission: PermissionTypes;
@@ -63,6 +80,7 @@ type PermissionRequestParameter = {
63
80
  from?: Address | undefined | null;
64
81
  expiry?: number | undefined | null;
65
82
  redeemer?: readonly Address[] | undefined | null;
83
+ payee?: readonly Address[] | undefined | null;
66
84
  };
67
85
  type SupportedPermissionInfo = {
68
86
  chainIds: number[];
@@ -227,6 +245,7 @@ declare const erc7710BundlerActions: () => (client: Client) => {
227
245
 
228
246
  type index_CaveatEnforcerParams = CaveatEnforcerParams;
229
247
  type index_DelegatedCall = DelegatedCall;
248
+ type index_Erc20TokenAllowancePermission = Erc20TokenAllowancePermission;
230
249
  type index_Erc20TokenPeriodicPermission = Erc20TokenPeriodicPermission;
231
250
  type index_Erc20TokenRevocationPermission = Erc20TokenRevocationPermission;
232
251
  type index_Erc20TokenStreamPermission = Erc20TokenStreamPermission;
@@ -235,6 +254,7 @@ type index_GetGrantedExecutionPermissionsResult = GetGrantedExecutionPermissions
235
254
  type index_GetSupportedExecutionPermissionsResult = GetSupportedExecutionPermissionsResult;
236
255
  type index_MetaMaskExtensionClient = MetaMaskExtensionClient;
237
256
  type index_MetaMaskExtensionSchema = MetaMaskExtensionSchema;
257
+ type index_NativeTokenAllowancePermission = NativeTokenAllowancePermission;
238
258
  type index_NativeTokenPeriodicPermission = NativeTokenPeriodicPermission;
239
259
  type index_NativeTokenStreamPermission = NativeTokenStreamPermission;
240
260
  type index_PeriodTransferResult = PeriodTransferResult;
@@ -267,7 +287,7 @@ declare const index_signDelegationActions: typeof signDelegationActions;
267
287
  declare const index_signUserOperation: typeof signUserOperation;
268
288
  declare const index_signUserOperationActions: typeof signUserOperationActions;
269
289
  declare namespace index {
270
- export { type index_CaveatEnforcerParams as CaveatEnforcerParams, type index_DelegatedCall as DelegatedCall, type index_Erc20TokenPeriodicPermission as Erc20TokenPeriodicPermission, type index_Erc20TokenRevocationPermission as Erc20TokenRevocationPermission, type index_Erc20TokenStreamPermission as Erc20TokenStreamPermission, type index_Erc7715Client as Erc7715Client, type index_GetGrantedExecutionPermissionsResult as GetGrantedExecutionPermissionsResult, type index_GetSupportedExecutionPermissionsResult as GetSupportedExecutionPermissionsResult, type index_MetaMaskExtensionClient as MetaMaskExtensionClient, type index_MetaMaskExtensionSchema as MetaMaskExtensionSchema, type index_NativeTokenPeriodicPermission as NativeTokenPeriodicPermission, type index_NativeTokenStreamPermission as NativeTokenStreamPermission, type index_PeriodTransferResult as PeriodTransferResult, type index_PermissionRequestParameter as PermissionRequestParameter, type index_PermissionTypes as PermissionTypes, type index_RequestExecutionPermissionsParameters as RequestExecutionPermissionsParameters, type index_RequestExecutionPermissionsReturnType as RequestExecutionPermissionsReturnType, type index_RpcGetGrantedExecutionPermissionsResult as RpcGetGrantedExecutionPermissionsResult, type index_RpcGetSupportedExecutionPermissionsResult as RpcGetSupportedExecutionPermissionsResult, type index_RpcSupportedPermissionInfo as RpcSupportedPermissionInfo, index_Rule as Rule, type index_SignDelegationParameters as SignDelegationParameters, type index_SignDelegationReturnType as SignDelegationReturnType, type index_SignUserOperationParameters as SignUserOperationParameters, type index_SignUserOperationReturnType as SignUserOperationReturnType, type index_StreamingResult as StreamingResult, type index_SupportedPermissionInfo as SupportedPermissionInfo, index_caveatEnforcerActions as caveatEnforcerActions, index_erc7710BundlerActions as erc7710BundlerActions, index_erc7710WalletActions as erc7710WalletActions, index_erc7715ProviderActions as erc7715ProviderActions, index_getErc20PeriodTransferEnforcerAvailableAmount as getErc20PeriodTransferEnforcerAvailableAmount, index_getErc20StreamingEnforcerAvailableAmount as getErc20StreamingEnforcerAvailableAmount, erc7715GetGrantedExecutionPermissionsAction as getGrantedExecutionPermissions, index_getMultiTokenPeriodEnforcerAvailableAmount as getMultiTokenPeriodEnforcerAvailableAmount, index_getNativeTokenPeriodTransferEnforcerAvailableAmount as getNativeTokenPeriodTransferEnforcerAvailableAmount, index_getNativeTokenStreamingEnforcerAvailableAmount as getNativeTokenStreamingEnforcerAvailableAmount, erc7715GetSupportedExecutionPermissionsAction as getSupportedExecutionPermissions, index_isValid7702Implementation as isValid7702Implementation, erc7715RequestExecutionPermissionsAction as requestExecutionPermissions, index_signDelegation as signDelegation, index_signDelegationActions as signDelegationActions, index_signUserOperation as signUserOperation, index_signUserOperationActions as signUserOperationActions };
290
+ export { type index_CaveatEnforcerParams as CaveatEnforcerParams, type index_DelegatedCall as DelegatedCall, type index_Erc20TokenAllowancePermission as Erc20TokenAllowancePermission, type index_Erc20TokenPeriodicPermission as Erc20TokenPeriodicPermission, type index_Erc20TokenRevocationPermission as Erc20TokenRevocationPermission, type index_Erc20TokenStreamPermission as Erc20TokenStreamPermission, type index_Erc7715Client as Erc7715Client, type index_GetGrantedExecutionPermissionsResult as GetGrantedExecutionPermissionsResult, type index_GetSupportedExecutionPermissionsResult as GetSupportedExecutionPermissionsResult, type index_MetaMaskExtensionClient as MetaMaskExtensionClient, type index_MetaMaskExtensionSchema as MetaMaskExtensionSchema, type index_NativeTokenAllowancePermission as NativeTokenAllowancePermission, type index_NativeTokenPeriodicPermission as NativeTokenPeriodicPermission, type index_NativeTokenStreamPermission as NativeTokenStreamPermission, type index_PeriodTransferResult as PeriodTransferResult, type index_PermissionRequestParameter as PermissionRequestParameter, type index_PermissionTypes as PermissionTypes, type index_RequestExecutionPermissionsParameters as RequestExecutionPermissionsParameters, type index_RequestExecutionPermissionsReturnType as RequestExecutionPermissionsReturnType, type index_RpcGetGrantedExecutionPermissionsResult as RpcGetGrantedExecutionPermissionsResult, type index_RpcGetSupportedExecutionPermissionsResult as RpcGetSupportedExecutionPermissionsResult, type index_RpcSupportedPermissionInfo as RpcSupportedPermissionInfo, index_Rule as Rule, type index_SignDelegationParameters as SignDelegationParameters, type index_SignDelegationReturnType as SignDelegationReturnType, type index_SignUserOperationParameters as SignUserOperationParameters, type index_SignUserOperationReturnType as SignUserOperationReturnType, type index_StreamingResult as StreamingResult, type index_SupportedPermissionInfo as SupportedPermissionInfo, index_caveatEnforcerActions as caveatEnforcerActions, index_erc7710BundlerActions as erc7710BundlerActions, index_erc7710WalletActions as erc7710WalletActions, index_erc7715ProviderActions as erc7715ProviderActions, index_getErc20PeriodTransferEnforcerAvailableAmount as getErc20PeriodTransferEnforcerAvailableAmount, index_getErc20StreamingEnforcerAvailableAmount as getErc20StreamingEnforcerAvailableAmount, erc7715GetGrantedExecutionPermissionsAction as getGrantedExecutionPermissions, index_getMultiTokenPeriodEnforcerAvailableAmount as getMultiTokenPeriodEnforcerAvailableAmount, index_getNativeTokenPeriodTransferEnforcerAvailableAmount as getNativeTokenPeriodTransferEnforcerAvailableAmount, index_getNativeTokenStreamingEnforcerAvailableAmount as getNativeTokenStreamingEnforcerAvailableAmount, erc7715GetSupportedExecutionPermissionsAction as getSupportedExecutionPermissions, index_isValid7702Implementation as isValid7702Implementation, erc7715RequestExecutionPermissionsAction as requestExecutionPermissions, index_signDelegation as signDelegation, index_signDelegationActions as signDelegationActions, index_signUserOperation as signUserOperation, index_signUserOperationActions as signUserOperationActions };
271
291
  }
272
292
 
273
- export { getNativeTokenPeriodTransferEnforcerAvailableAmount as A, getNativeTokenStreamingEnforcerAvailableAmount as B, type CaveatEnforcerParams as C, type DelegatedCall as D, type Erc20TokenPeriodicPermission as E, erc7715GetSupportedExecutionPermissionsAction as F, type GetGrantedExecutionPermissionsResult as G, isValid7702Implementation as H, erc7715RequestExecutionPermissionsAction as I, signDelegation as J, signDelegationActions as K, signUserOperation as L, type MetaMaskExtensionClient as M, type NativeTokenPeriodicPermission as N, signUserOperationActions as O, type PeriodTransferResult as P, type RequestExecutionPermissionsParameters as R, type SignDelegationParameters as S, type Erc20TokenRevocationPermission as a, type Erc20TokenStreamPermission as b, caveatEnforcerActions as c, type Erc7715Client as d, type GetSupportedExecutionPermissionsResult as e, type MetaMaskExtensionSchema as f, type NativeTokenStreamPermission as g, type PermissionRequestParameter as h, index as i, type PermissionTypes as j, type RequestExecutionPermissionsReturnType as k, type RpcGetGrantedExecutionPermissionsResult as l, type RpcGetSupportedExecutionPermissionsResult as m, type RpcSupportedPermissionInfo as n, type SignDelegationReturnType as o, type SignUserOperationParameters as p, type SignUserOperationReturnType as q, type StreamingResult as r, type SupportedPermissionInfo as s, erc7710BundlerActions as t, erc7710WalletActions as u, erc7715ProviderActions as v, getErc20PeriodTransferEnforcerAvailableAmount as w, getErc20StreamingEnforcerAvailableAmount as x, erc7715GetGrantedExecutionPermissionsAction as y, getMultiTokenPeriodEnforcerAvailableAmount as z };
293
+ export { erc7715GetGrantedExecutionPermissionsAction as A, getMultiTokenPeriodEnforcerAvailableAmount as B, type CaveatEnforcerParams as C, type DelegatedCall as D, type Erc20TokenAllowancePermission as E, getNativeTokenPeriodTransferEnforcerAvailableAmount as F, type GetGrantedExecutionPermissionsResult as G, getNativeTokenStreamingEnforcerAvailableAmount as H, erc7715GetSupportedExecutionPermissionsAction as I, isValid7702Implementation as J, erc7715RequestExecutionPermissionsAction as K, signDelegation as L, type MetaMaskExtensionClient as M, type NativeTokenAllowancePermission as N, signDelegationActions as O, type PeriodTransferResult as P, signUserOperation as Q, type RequestExecutionPermissionsParameters as R, type SignDelegationParameters as S, signUserOperationActions as T, type Erc20TokenPeriodicPermission as a, type Erc20TokenRevocationPermission as b, caveatEnforcerActions as c, type Erc20TokenStreamPermission as d, type Erc7715Client as e, type GetSupportedExecutionPermissionsResult as f, type MetaMaskExtensionSchema as g, type NativeTokenPeriodicPermission as h, index as i, type NativeTokenStreamPermission as j, type PermissionRequestParameter as k, type PermissionTypes as l, type RequestExecutionPermissionsReturnType as m, type RpcGetGrantedExecutionPermissionsResult as n, type RpcGetSupportedExecutionPermissionsResult as o, type RpcSupportedPermissionInfo as p, type SignDelegationReturnType as q, type SignUserOperationParameters as r, type SignUserOperationReturnType as s, type StreamingResult as t, type SupportedPermissionInfo as u, erc7710BundlerActions as v, erc7710WalletActions as w, erc7715ProviderActions as x, getErc20PeriodTransferEnforcerAvailableAmount as y, getErc20StreamingEnforcerAvailableAmount as z };
@@ -49,13 +49,30 @@ type Erc20TokenPeriodicPermission = BasePermission & {
49
49
  justification?: string;
50
50
  };
51
51
  };
52
+ type NativeTokenAllowancePermission = BasePermission & {
53
+ type: 'native-token-allowance';
54
+ data: {
55
+ allowanceAmount: bigint;
56
+ startTime?: number;
57
+ justification?: string;
58
+ };
59
+ };
60
+ type Erc20TokenAllowancePermission = BasePermission & {
61
+ type: 'erc20-token-allowance';
62
+ data: {
63
+ allowanceAmount: bigint;
64
+ startTime?: number;
65
+ tokenAddress: Address;
66
+ justification?: string;
67
+ };
68
+ };
52
69
  type Erc20TokenRevocationPermission = BasePermission & {
53
70
  type: 'erc20-token-revocation';
54
71
  data: {
55
72
  justification?: string;
56
73
  };
57
74
  };
58
- type PermissionTypes = NativeTokenStreamPermission | NativeTokenPeriodicPermission | Erc20TokenStreamPermission | Erc20TokenPeriodicPermission | Erc20TokenRevocationPermission;
75
+ type PermissionTypes = NativeTokenStreamPermission | NativeTokenPeriodicPermission | NativeTokenAllowancePermission | Erc20TokenStreamPermission | Erc20TokenPeriodicPermission | Erc20TokenAllowancePermission | Erc20TokenRevocationPermission;
59
76
  type PermissionRequestParameter = {
60
77
  chainId: number;
61
78
  permission: PermissionTypes;
@@ -63,6 +80,7 @@ type PermissionRequestParameter = {
63
80
  from?: Address | undefined | null;
64
81
  expiry?: number | undefined | null;
65
82
  redeemer?: readonly Address[] | undefined | null;
83
+ payee?: readonly Address[] | undefined | null;
66
84
  };
67
85
  type SupportedPermissionInfo = {
68
86
  chainIds: number[];
@@ -227,6 +245,7 @@ declare const erc7710BundlerActions: () => (client: Client) => {
227
245
 
228
246
  type index_CaveatEnforcerParams = CaveatEnforcerParams;
229
247
  type index_DelegatedCall = DelegatedCall;
248
+ type index_Erc20TokenAllowancePermission = Erc20TokenAllowancePermission;
230
249
  type index_Erc20TokenPeriodicPermission = Erc20TokenPeriodicPermission;
231
250
  type index_Erc20TokenRevocationPermission = Erc20TokenRevocationPermission;
232
251
  type index_Erc20TokenStreamPermission = Erc20TokenStreamPermission;
@@ -235,6 +254,7 @@ type index_GetGrantedExecutionPermissionsResult = GetGrantedExecutionPermissions
235
254
  type index_GetSupportedExecutionPermissionsResult = GetSupportedExecutionPermissionsResult;
236
255
  type index_MetaMaskExtensionClient = MetaMaskExtensionClient;
237
256
  type index_MetaMaskExtensionSchema = MetaMaskExtensionSchema;
257
+ type index_NativeTokenAllowancePermission = NativeTokenAllowancePermission;
238
258
  type index_NativeTokenPeriodicPermission = NativeTokenPeriodicPermission;
239
259
  type index_NativeTokenStreamPermission = NativeTokenStreamPermission;
240
260
  type index_PeriodTransferResult = PeriodTransferResult;
@@ -267,7 +287,7 @@ declare const index_signDelegationActions: typeof signDelegationActions;
267
287
  declare const index_signUserOperation: typeof signUserOperation;
268
288
  declare const index_signUserOperationActions: typeof signUserOperationActions;
269
289
  declare namespace index {
270
- export { type index_CaveatEnforcerParams as CaveatEnforcerParams, type index_DelegatedCall as DelegatedCall, type index_Erc20TokenPeriodicPermission as Erc20TokenPeriodicPermission, type index_Erc20TokenRevocationPermission as Erc20TokenRevocationPermission, type index_Erc20TokenStreamPermission as Erc20TokenStreamPermission, type index_Erc7715Client as Erc7715Client, type index_GetGrantedExecutionPermissionsResult as GetGrantedExecutionPermissionsResult, type index_GetSupportedExecutionPermissionsResult as GetSupportedExecutionPermissionsResult, type index_MetaMaskExtensionClient as MetaMaskExtensionClient, type index_MetaMaskExtensionSchema as MetaMaskExtensionSchema, type index_NativeTokenPeriodicPermission as NativeTokenPeriodicPermission, type index_NativeTokenStreamPermission as NativeTokenStreamPermission, type index_PeriodTransferResult as PeriodTransferResult, type index_PermissionRequestParameter as PermissionRequestParameter, type index_PermissionTypes as PermissionTypes, type index_RequestExecutionPermissionsParameters as RequestExecutionPermissionsParameters, type index_RequestExecutionPermissionsReturnType as RequestExecutionPermissionsReturnType, type index_RpcGetGrantedExecutionPermissionsResult as RpcGetGrantedExecutionPermissionsResult, type index_RpcGetSupportedExecutionPermissionsResult as RpcGetSupportedExecutionPermissionsResult, type index_RpcSupportedPermissionInfo as RpcSupportedPermissionInfo, index_Rule as Rule, type index_SignDelegationParameters as SignDelegationParameters, type index_SignDelegationReturnType as SignDelegationReturnType, type index_SignUserOperationParameters as SignUserOperationParameters, type index_SignUserOperationReturnType as SignUserOperationReturnType, type index_StreamingResult as StreamingResult, type index_SupportedPermissionInfo as SupportedPermissionInfo, index_caveatEnforcerActions as caveatEnforcerActions, index_erc7710BundlerActions as erc7710BundlerActions, index_erc7710WalletActions as erc7710WalletActions, index_erc7715ProviderActions as erc7715ProviderActions, index_getErc20PeriodTransferEnforcerAvailableAmount as getErc20PeriodTransferEnforcerAvailableAmount, index_getErc20StreamingEnforcerAvailableAmount as getErc20StreamingEnforcerAvailableAmount, erc7715GetGrantedExecutionPermissionsAction as getGrantedExecutionPermissions, index_getMultiTokenPeriodEnforcerAvailableAmount as getMultiTokenPeriodEnforcerAvailableAmount, index_getNativeTokenPeriodTransferEnforcerAvailableAmount as getNativeTokenPeriodTransferEnforcerAvailableAmount, index_getNativeTokenStreamingEnforcerAvailableAmount as getNativeTokenStreamingEnforcerAvailableAmount, erc7715GetSupportedExecutionPermissionsAction as getSupportedExecutionPermissions, index_isValid7702Implementation as isValid7702Implementation, erc7715RequestExecutionPermissionsAction as requestExecutionPermissions, index_signDelegation as signDelegation, index_signDelegationActions as signDelegationActions, index_signUserOperation as signUserOperation, index_signUserOperationActions as signUserOperationActions };
290
+ export { type index_CaveatEnforcerParams as CaveatEnforcerParams, type index_DelegatedCall as DelegatedCall, type index_Erc20TokenAllowancePermission as Erc20TokenAllowancePermission, type index_Erc20TokenPeriodicPermission as Erc20TokenPeriodicPermission, type index_Erc20TokenRevocationPermission as Erc20TokenRevocationPermission, type index_Erc20TokenStreamPermission as Erc20TokenStreamPermission, type index_Erc7715Client as Erc7715Client, type index_GetGrantedExecutionPermissionsResult as GetGrantedExecutionPermissionsResult, type index_GetSupportedExecutionPermissionsResult as GetSupportedExecutionPermissionsResult, type index_MetaMaskExtensionClient as MetaMaskExtensionClient, type index_MetaMaskExtensionSchema as MetaMaskExtensionSchema, type index_NativeTokenAllowancePermission as NativeTokenAllowancePermission, type index_NativeTokenPeriodicPermission as NativeTokenPeriodicPermission, type index_NativeTokenStreamPermission as NativeTokenStreamPermission, type index_PeriodTransferResult as PeriodTransferResult, type index_PermissionRequestParameter as PermissionRequestParameter, type index_PermissionTypes as PermissionTypes, type index_RequestExecutionPermissionsParameters as RequestExecutionPermissionsParameters, type index_RequestExecutionPermissionsReturnType as RequestExecutionPermissionsReturnType, type index_RpcGetGrantedExecutionPermissionsResult as RpcGetGrantedExecutionPermissionsResult, type index_RpcGetSupportedExecutionPermissionsResult as RpcGetSupportedExecutionPermissionsResult, type index_RpcSupportedPermissionInfo as RpcSupportedPermissionInfo, index_Rule as Rule, type index_SignDelegationParameters as SignDelegationParameters, type index_SignDelegationReturnType as SignDelegationReturnType, type index_SignUserOperationParameters as SignUserOperationParameters, type index_SignUserOperationReturnType as SignUserOperationReturnType, type index_StreamingResult as StreamingResult, type index_SupportedPermissionInfo as SupportedPermissionInfo, index_caveatEnforcerActions as caveatEnforcerActions, index_erc7710BundlerActions as erc7710BundlerActions, index_erc7710WalletActions as erc7710WalletActions, index_erc7715ProviderActions as erc7715ProviderActions, index_getErc20PeriodTransferEnforcerAvailableAmount as getErc20PeriodTransferEnforcerAvailableAmount, index_getErc20StreamingEnforcerAvailableAmount as getErc20StreamingEnforcerAvailableAmount, erc7715GetGrantedExecutionPermissionsAction as getGrantedExecutionPermissions, index_getMultiTokenPeriodEnforcerAvailableAmount as getMultiTokenPeriodEnforcerAvailableAmount, index_getNativeTokenPeriodTransferEnforcerAvailableAmount as getNativeTokenPeriodTransferEnforcerAvailableAmount, index_getNativeTokenStreamingEnforcerAvailableAmount as getNativeTokenStreamingEnforcerAvailableAmount, erc7715GetSupportedExecutionPermissionsAction as getSupportedExecutionPermissions, index_isValid7702Implementation as isValid7702Implementation, erc7715RequestExecutionPermissionsAction as requestExecutionPermissions, index_signDelegation as signDelegation, index_signDelegationActions as signDelegationActions, index_signUserOperation as signUserOperation, index_signUserOperationActions as signUserOperationActions };
271
291
  }
272
292
 
273
- export { getNativeTokenPeriodTransferEnforcerAvailableAmount as A, getNativeTokenStreamingEnforcerAvailableAmount as B, type CaveatEnforcerParams as C, type DelegatedCall as D, type Erc20TokenPeriodicPermission as E, erc7715GetSupportedExecutionPermissionsAction as F, type GetGrantedExecutionPermissionsResult as G, isValid7702Implementation as H, erc7715RequestExecutionPermissionsAction as I, signDelegation as J, signDelegationActions as K, signUserOperation as L, type MetaMaskExtensionClient as M, type NativeTokenPeriodicPermission as N, signUserOperationActions as O, type PeriodTransferResult as P, type RequestExecutionPermissionsParameters as R, type SignDelegationParameters as S, type Erc20TokenRevocationPermission as a, type Erc20TokenStreamPermission as b, caveatEnforcerActions as c, type Erc7715Client as d, type GetSupportedExecutionPermissionsResult as e, type MetaMaskExtensionSchema as f, type NativeTokenStreamPermission as g, type PermissionRequestParameter as h, index as i, type PermissionTypes as j, type RequestExecutionPermissionsReturnType as k, type RpcGetGrantedExecutionPermissionsResult as l, type RpcGetSupportedExecutionPermissionsResult as m, type RpcSupportedPermissionInfo as n, type SignDelegationReturnType as o, type SignUserOperationParameters as p, type SignUserOperationReturnType as q, type StreamingResult as r, type SupportedPermissionInfo as s, erc7710BundlerActions as t, erc7710WalletActions as u, erc7715ProviderActions as v, getErc20PeriodTransferEnforcerAvailableAmount as w, getErc20StreamingEnforcerAvailableAmount as x, erc7715GetGrantedExecutionPermissionsAction as y, getMultiTokenPeriodEnforcerAvailableAmount as z };
293
+ export { erc7715GetGrantedExecutionPermissionsAction as A, getMultiTokenPeriodEnforcerAvailableAmount as B, type CaveatEnforcerParams as C, type DelegatedCall as D, type Erc20TokenAllowancePermission as E, getNativeTokenPeriodTransferEnforcerAvailableAmount as F, type GetGrantedExecutionPermissionsResult as G, getNativeTokenStreamingEnforcerAvailableAmount as H, erc7715GetSupportedExecutionPermissionsAction as I, isValid7702Implementation as J, erc7715RequestExecutionPermissionsAction as K, signDelegation as L, type MetaMaskExtensionClient as M, type NativeTokenAllowancePermission as N, signDelegationActions as O, type PeriodTransferResult as P, signUserOperation as Q, type RequestExecutionPermissionsParameters as R, type SignDelegationParameters as S, signUserOperationActions as T, type Erc20TokenPeriodicPermission as a, type Erc20TokenRevocationPermission as b, caveatEnforcerActions as c, type Erc20TokenStreamPermission as d, type Erc7715Client as e, type GetSupportedExecutionPermissionsResult as f, type MetaMaskExtensionSchema as g, type NativeTokenPeriodicPermission as h, index as i, type NativeTokenStreamPermission as j, type PermissionRequestParameter as k, type PermissionTypes as l, type RequestExecutionPermissionsReturnType as m, type RpcGetGrantedExecutionPermissionsResult as n, type RpcGetSupportedExecutionPermissionsResult as o, type RpcSupportedPermissionInfo as p, type SignDelegationReturnType as q, type SignUserOperationParameters as r, type SignUserOperationReturnType as s, type StreamingResult as t, type SupportedPermissionInfo as u, erc7710BundlerActions as v, erc7710WalletActions as w, erc7715ProviderActions as x, getErc20PeriodTransferEnforcerAvailableAmount as y, getErc20StreamingEnforcerAvailableAmount as z };
@@ -1,7 +1,7 @@
1
1
  import { ANY_BENEFICIARY, ROOT_AUTHORITY } from '@metamask/delegation-core';
2
2
  import * as viem from 'viem';
3
3
  import { Client, Transport, Chain, Account, Address, Hex } from 'viem';
4
- import { m as DelegationStruct, E as ExecutionMode, d as ExecutionStruct } from './delegation-Bx4FEAIU.js';
4
+ import { m as DelegationStruct, E as ExecutionMode, d as ExecutionStruct } from './delegation-CR99q1-n.js';
5
5
  import { D as Delegation, P as PermissionContext } from './types-BWaH4KH1.js';
6
6
 
7
7
  declare const NAME$1 = "DelegationManager";
@@ -1,7 +1,7 @@
1
1
  import { ANY_BENEFICIARY, ROOT_AUTHORITY } from '@metamask/delegation-core';
2
2
  import * as viem from 'viem';
3
3
  import { Client, Transport, Chain, Account, Address, Hex } from 'viem';
4
- import { m as DelegationStruct, E as ExecutionMode, d as ExecutionStruct } from './delegation-KbWHzRxV.cjs';
4
+ import { m as DelegationStruct, E as ExecutionMode, d as ExecutionStruct } from './delegation-DoVULGYE.cjs';
5
5
  import { D as Delegation, P as PermissionContext } from './types-BWaH4KH1.cjs';
6
6
 
7
7
  declare const NAME$1 = "DelegationManager";