ox 0.14.61 → 0.14.63

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 (77) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/_cjs/core/AbiEvent.js +14 -8
  3. package/_cjs/core/AbiEvent.js.map +1 -1
  4. package/_cjs/core/AbiItem.js +8 -1
  5. package/_cjs/core/AbiItem.js.map +1 -1
  6. package/_cjs/core/Caches.js +3 -6
  7. package/_cjs/core/Caches.js.map +1 -1
  8. package/_cjs/core/Hex.js +2 -1
  9. package/_cjs/core/Hex.js.map +1 -1
  10. package/_cjs/core/Siwe.js +10 -5
  11. package/_cjs/core/Siwe.js.map +1 -1
  12. package/_cjs/core/TypedData.js +7 -4
  13. package/_cjs/core/TypedData.js.map +1 -1
  14. package/_cjs/core/Value.js +5 -3
  15. package/_cjs/core/Value.js.map +1 -1
  16. package/_cjs/core/internal/abiItem.js +6 -3
  17. package/_cjs/core/internal/abiItem.js.map +1 -1
  18. package/_cjs/core/internal/caches.js +9 -0
  19. package/_cjs/core/internal/caches.js.map +1 -0
  20. package/_cjs/core/internal/frameNonce.js +2 -2
  21. package/_cjs/core/internal/frameNonce.js.map +1 -1
  22. package/_cjs/tempo/AccountOperation.js +26 -6
  23. package/_cjs/tempo/AccountOperation.js.map +1 -1
  24. package/_cjs/version.js +1 -1
  25. package/_esm/core/AbiEvent.js +18 -8
  26. package/_esm/core/AbiEvent.js.map +1 -1
  27. package/_esm/core/AbiItem.js +10 -1
  28. package/_esm/core/AbiItem.js.map +1 -1
  29. package/_esm/core/Caches.js +1 -4
  30. package/_esm/core/Caches.js.map +1 -1
  31. package/_esm/core/Hex.js +2 -1
  32. package/_esm/core/Hex.js.map +1 -1
  33. package/_esm/core/Siwe.js +11 -5
  34. package/_esm/core/Siwe.js.map +1 -1
  35. package/_esm/core/TypedData.js +7 -4
  36. package/_esm/core/TypedData.js.map +1 -1
  37. package/_esm/core/Value.js +5 -3
  38. package/_esm/core/Value.js.map +1 -1
  39. package/_esm/core/internal/abiItem.js +18 -7
  40. package/_esm/core/internal/abiItem.js.map +1 -1
  41. package/_esm/core/internal/caches.js +10 -0
  42. package/_esm/core/internal/caches.js.map +1 -0
  43. package/_esm/core/internal/frameNonce.js +2 -2
  44. package/_esm/core/internal/frameNonce.js.map +1 -1
  45. package/_esm/tempo/AccountOperation.js +26 -6
  46. package/_esm/tempo/AccountOperation.js.map +1 -1
  47. package/_esm/version.js +1 -1
  48. package/_types/core/AbiEvent.d.ts +2 -4
  49. package/_types/core/AbiEvent.d.ts.map +1 -1
  50. package/_types/core/AbiItem.d.ts.map +1 -1
  51. package/_types/core/Caches.d.ts +1 -2
  52. package/_types/core/Caches.d.ts.map +1 -1
  53. package/_types/core/Hex.d.ts.map +1 -1
  54. package/_types/core/Siwe.d.ts.map +1 -1
  55. package/_types/core/TypedData.d.ts.map +1 -1
  56. package/_types/core/Value.d.ts.map +1 -1
  57. package/_types/core/internal/abiItem.d.ts.map +1 -1
  58. package/_types/core/internal/caches.d.ts +10 -0
  59. package/_types/core/internal/caches.d.ts.map +1 -0
  60. package/_types/core/internal/frameNonce.d.ts.map +1 -1
  61. package/_types/tempo/AccountOperation.d.ts +8 -0
  62. package/_types/tempo/AccountOperation.d.ts.map +1 -1
  63. package/_types/version.d.ts +1 -1
  64. package/core/AbiEvent.ts +22 -11
  65. package/core/AbiItem.ts +9 -1
  66. package/core/Caches.ts +1 -6
  67. package/core/Hex.ts +3 -1
  68. package/core/Siwe.ts +13 -7
  69. package/core/TypedData.ts +8 -4
  70. package/core/Value.ts +6 -3
  71. package/core/internal/abiItem.ts +21 -14
  72. package/core/internal/caches.ts +12 -0
  73. package/core/internal/frameNonce.ts +3 -4
  74. package/package.json +1 -1
  75. package/tempo/AccountOperation.test.ts +116 -0
  76. package/tempo/AccountOperation.ts +38 -5
  77. package/version.ts +1 -1
@@ -43,6 +43,12 @@ export type TransactionOperation<quantity = bigint> = Base<quantity> & {
43
43
  transactionHash?: Hex.Hex | undefined
44
44
  /** Operation kind. */
45
45
  type: 'transaction'
46
+ /**
47
+ * Parent account when the configurable account signs as its access key
48
+ * (TIP-1111). The transaction is then sent from it with a keychain V2
49
+ * signature wrapping the owner quorum.
50
+ */
51
+ userAddress?: Address.Address | undefined
46
52
  }
47
53
 
48
54
  /** Account key authorization approval operation. */
@@ -96,6 +102,7 @@ export function getHash(options: getHash.Options): Hex.Hex {
96
102
  TxEnvelopeTempo.deserialize(
97
103
  options.transaction as TxEnvelopeTempo.Serialized,
98
104
  ),
105
+ { from: options.userAddress },
99
106
  )
100
107
  : KeyAuthorization_.getSignPayload(
101
108
  KeyAuthorization_.deserialize(options.keyAuthorization),
@@ -126,6 +133,8 @@ export declare namespace getHash {
126
133
  transaction: Hex.Hex
127
134
  /** Operation kind. */
128
135
  type: 'transaction'
136
+ /** Parent account when the configurable account signs as its access key. */
137
+ userAddress?: Address.Address | undefined
129
138
  }
130
139
  )
131
140
 
@@ -331,17 +340,26 @@ export function serializeTransaction(
331
340
  assertApproval(value.account, approval, value.config),
332
341
  )
333
342
  assertRetainedApprovals(value, approvals)
343
+ const { userAddress } = value
334
344
  const signatures = SignatureEnvelope.sortApprovals({
335
345
  account: value.account,
336
346
  config: value.config,
337
- payload: TxEnvelopeTempo.getSignPayload(envelope),
347
+ payload: TxEnvelopeTempo.getSignPayload(envelope, { from: userAddress }),
338
348
  signatures: approvals,
339
349
  })
340
- const signature = SignatureEnvelope.from({
350
+ const configurable = SignatureEnvelope.from({
341
351
  account: value.account,
342
352
  config: value.config,
343
353
  signatures,
344
354
  })
355
+ const signature = userAddress
356
+ ? SignatureEnvelope.from({
357
+ inner: configurable,
358
+ type: 'keychain',
359
+ userAddress,
360
+ version: 'v2',
361
+ })
362
+ : configurable
345
363
  return TxEnvelopeTempo.serialize(
346
364
  envelope,
347
365
  value.transaction.startsWith(TxEnvelopeTempo.feePayerMagic)
@@ -803,14 +821,27 @@ function assertTransaction(operation: TransactionOperation): void {
803
821
  throw new InvalidOperationError({
804
822
  reason: 'transaction must not contain an outer sender signature',
805
823
  })
824
+ const { userAddress } = operation
825
+ if (userAddress !== undefined) {
826
+ if (!Address.validate(userAddress) || Hex.toBigInt(userAddress) === 0n)
827
+ throw new InvalidOperationError({ reason: 'userAddress is invalid' })
828
+ if (userAddress.toLowerCase() === operation.account.toLowerCase())
829
+ throw new InvalidOperationError({
830
+ reason: 'a configurable account cannot be its own access key',
831
+ })
832
+ }
833
+ const sender = userAddress ?? operation.account
806
834
  if (
807
835
  transaction.from &&
808
- transaction.from.toLowerCase() !== operation.account.toLowerCase()
836
+ transaction.from.toLowerCase() !== sender.toLowerCase()
809
837
  )
810
838
  throw new InvalidOperationError({
811
839
  reason: 'transaction sender does not match the operation account',
812
840
  })
813
- assertOperationHash(operation, TxEnvelopeTempo.getSignPayload(transaction))
841
+ assertOperationHash(
842
+ operation,
843
+ TxEnvelopeTempo.getSignPayload(transaction, { from: userAddress }),
844
+ )
814
845
  const feePayer = operation.transaction.startsWith(
815
846
  TxEnvelopeTempo.feePayerMagic,
816
847
  )
@@ -842,12 +873,14 @@ function assertKeyAuthorization(
842
873
  submissionId?: unknown
843
874
  transaction?: unknown
844
875
  transactionHash?: unknown
876
+ userAddress?: unknown
845
877
  }
846
878
  if (
847
879
  transactionFields.expiresAt !== undefined ||
848
880
  transactionFields.submissionId !== undefined ||
849
881
  transactionFields.transaction !== undefined ||
850
- transactionFields.transactionHash !== undefined
882
+ transactionFields.transactionHash !== undefined ||
883
+ transactionFields.userAddress !== undefined
851
884
  )
852
885
  throw new InvalidOperationError({
853
886
  reason: 'key authorization operations cannot contain transaction fields',
package/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** @internal */
2
- export const version = '0.14.61'
2
+ export const version = '0.14.63'