@algorandfoundation/algokit-utils 10.0.0-alpha.3 → 10.0.0-alpha.5

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 (45) hide show
  1. package/package.json +1 -1
  2. package/packages/abi/src/abi-method.d.ts +1 -1
  3. package/packages/abi/src/abi-method.js.map +1 -1
  4. package/packages/abi/src/abi-method.mjs.map +1 -1
  5. package/packages/algod_client/src/models/application-state-schema.d.ts +2 -2
  6. package/packages/algod_client/src/models/application-state-schema.js +2 -2
  7. package/packages/algod_client/src/models/application-state-schema.js.map +1 -1
  8. package/packages/algod_client/src/models/application-state-schema.mjs +2 -2
  9. package/packages/algod_client/src/models/application-state-schema.mjs.map +1 -1
  10. package/packages/common/src/json.mjs +2 -2
  11. package/packages/common/src/json.mjs.map +1 -1
  12. package/packages/indexer_client/src/models/application-state-schema.d.ts +2 -2
  13. package/packages/indexer_client/src/models/application-state-schema.js +2 -2
  14. package/packages/indexer_client/src/models/application-state-schema.js.map +1 -1
  15. package/packages/indexer_client/src/models/application-state-schema.mjs +2 -2
  16. package/packages/indexer_client/src/models/application-state-schema.mjs.map +1 -1
  17. package/packages/indexer_client/src/models/state-schema.d.ts +2 -2
  18. package/packages/indexer_client/src/models/state-schema.js +2 -2
  19. package/packages/indexer_client/src/models/state-schema.js.map +1 -1
  20. package/packages/indexer_client/src/models/state-schema.mjs +2 -2
  21. package/packages/indexer_client/src/models/state-schema.mjs.map +1 -1
  22. package/packages/indexer_client/src/models/transaction.d.ts +2 -2
  23. package/packages/indexer_client/src/models/transaction.js +2 -2
  24. package/packages/indexer_client/src/models/transaction.js.map +1 -1
  25. package/packages/indexer_client/src/models/transaction.mjs +2 -2
  26. package/packages/indexer_client/src/models/transaction.mjs.map +1 -1
  27. package/packages/sdk/src/utils/utils.mjs +2 -2
  28. package/packages/sdk/src/utils/utils.mjs.map +1 -1
  29. package/transactions/method-call.js +12 -12
  30. package/transactions/method-call.js.map +1 -1
  31. package/transactions/method-call.mjs +12 -12
  32. package/transactions/method-call.mjs.map +1 -1
  33. package/types/algorand-client-transaction-creator.d.ts +44 -44
  34. package/types/algorand-client-transaction-sender.d.ts +46 -46
  35. package/types/app-client.d.ts +99 -99
  36. package/types/app-factory.d.ts +36 -36
  37. package/types/app-manager.d.ts +1 -1
  38. package/types/app-manager.js +10 -5
  39. package/types/app-manager.js.map +1 -1
  40. package/types/app-manager.mjs +10 -5
  41. package/types/app-manager.mjs.map +1 -1
  42. package/types/composer.js +3 -6
  43. package/types/composer.js.map +1 -1
  44. package/types/composer.mjs +3 -6
  45. package/types/composer.mjs.map +1 -1
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "**"
7
7
  ],
8
8
  "name": "@algorandfoundation/algokit-utils",
9
- "version": "10.0.0-alpha.3",
9
+ "version": "10.0.0-alpha.5",
10
10
  "private": false,
11
11
  "description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
12
12
  "author": "Algorand Foundation",
@@ -61,7 +61,7 @@ type ABIReturn = {
61
61
  rawReturnValue?: undefined;
62
62
  returnValue?: undefined;
63
63
  method: ABIMethod;
64
- decodeError: Error;
64
+ decodeError?: Error;
65
65
  };
66
66
  declare class ABIMethod {
67
67
  readonly name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"abi-method.js","names":["sha512","parseTupleContent","ABIType","convertedDefaultValue: ABIDefaultValue | undefined","ABIStructType","ABIUintType","ABIAddressType"],"sources":["../../../../packages/abi/src/abi-method.ts"],"sourcesContent":["import sha512 from 'js-sha512'\nimport { ABIAddressType, ABIStructType, ABIType, ABIUintType, parseTupleContent } from './abi-type'\nimport { ABIValue } from './abi-value'\nimport { ARC28Event } from './arc28-event'\nimport { AVMType, Arc56Contract, Arc56Method } from './arc56-contract'\n\nexport enum ABITransactionType {\n Txn = 'txn',\n Payment = 'pay',\n KeyRegistration = 'keyreg',\n AssetConfig = 'acfg',\n AssetTransfer = 'axfer',\n AssetFreeze = 'afrz',\n AppCall = 'appl',\n}\nexport enum ABIReferenceType {\n Account = 'account',\n Application = 'application',\n Asset = 'asset',\n}\nexport type ABIMethodArgType = ABIType | ABITransactionType | ABIReferenceType\nexport type ABIMethodReturnType = ABIType | 'void'\n\nexport type ABIMethodArg = {\n type: ABIMethodArgType\n name?: string\n description?: string\n defaultValue?: ABIDefaultValue\n}\n\nexport type ABIMethodReturn = {\n type: ABIMethodReturnType\n description?: string\n}\n\nexport type ABIDefaultValue = {\n /** Base64 encoded bytes, base64 ARC4 encoded uint64, or UTF-8 method selector */\n data: string\n /** Where the default value is coming from */\n source: DefaultValueSource\n /** How the data is encoded. This is the encoding for the data provided here, not the arg type */\n type?: ABIType | AVMType\n}\n\nexport enum DefaultValueSource {\n Box = 'box',\n Global = 'global',\n Local = 'local',\n Literal = 'literal',\n Method = 'method',\n}\n\n/** Represents an ABI method return value with parsed data. */\nexport type ABIReturn =\n | {\n /** The method that was called. */\n method: ABIMethod\n /** The raw return value as bytes.\n *\n * This is the value from the last app call log with the first 4 bytes (the ABI return prefix) omitted.\n */\n rawReturnValue: Uint8Array\n /** The parsed ABI return value. */\n returnValue: ABIValue\n decodeError: undefined\n }\n | { rawReturnValue?: undefined; returnValue?: undefined; method: ABIMethod; decodeError: Error }\n\n/** Decoded ARC-56 struct as a struct rather than a tuple. */\nexport type ABIStruct = {\n [key: string]: ABIStruct | ABIValue\n}\n\nexport class ABIMethod {\n readonly name: string\n readonly description?: string\n readonly args: ABIMethodArg[]\n readonly returns: ABIMethodReturn\n readonly events?: ARC28Event[]\n readonly readonly?: boolean\n\n constructor(params: {\n name: string\n description?: string\n args: ABIMethodArg[]\n returns: ABIMethodReturn\n events?: ARC28Event[]\n readonly?: boolean\n }) {\n this.name = params.name\n this.description = params.description\n this.args = params.args\n this.returns = params.returns\n this.events = params.events\n this.readonly = params.readonly\n }\n\n /**\n * Returns the signature of this ABI method.\n * @returns The signature, e.g. `my_method(unit64,string)bytes`\n */\n getSignature(): string {\n const args = this.args\n .map((arg) => {\n if (argTypeIsTransaction(arg.type) || argTypeIsReference(arg.type)) return arg.type\n return arg.type.name\n })\n .join(',')\n const returns = this.returns.type === 'void' ? 'void' : this.returns.type.name\n return `${this.name}(${args})${returns}`\n }\n\n /**\n * Returns the method selector of this ABI method.\n * @returns The 4-byte method selector\n */\n getSelector(): Uint8Array {\n const hash = sha512.sha512_256.array(this.getSignature())\n return new Uint8Array(hash.slice(0, 4))\n }\n\n /**\n * Returns the ABI method object for a given method signature.\n * @param signature The method signature\n * e.g. `my_method(unit64,string)bytes`\n * @returns The `ABIMethod`\n */\n static fromSignature(signature: string): ABIMethod {\n const argsStart = signature.indexOf('(')\n if (argsStart === -1) {\n throw new Error(`Invalid method signature: ${signature}`)\n }\n\n let argsEnd = -1\n let depth = 0\n for (let i = argsStart; i < signature.length; i++) {\n const char = signature[i]\n\n if (char === '(') {\n depth += 1\n } else if (char === ')') {\n if (depth === 0) {\n // unpaired parenthesis\n break\n }\n\n depth -= 1\n if (depth === 0) {\n argsEnd = i\n break\n }\n }\n }\n\n if (argsEnd === -1) {\n throw new Error(`Invalid method signature: ${signature}`)\n }\n\n const name = signature.slice(0, argsStart)\n const args = parseTupleContent(signature.slice(argsStart + 1, argsEnd)).map((n: string) => {\n if (argTypeIsTransaction(n as ABIMethodArgType) || argTypeIsReference(n as ABIMethodArgType)) {\n return { type: n as ABIMethodArgType } satisfies ABIMethodArg\n }\n return { type: ABIType.from(n) } satisfies ABIMethodArg\n })\n const returnType = signature.slice(argsEnd + 1)\n const returns = { type: returnType === 'void' ? ('void' as const) : ABIType.from(returnType) } satisfies ABIMethodReturn\n\n return new ABIMethod({\n name,\n args,\n returns,\n })\n }\n}\n\n/**\n * Returns the ABI method object for a given method name or signature and ARC-56 app spec.\n * @param methodNameOrSignature The method name or method signature to call if an ABI call is being emitted.\n * e.g. `my_method` or `my_method(unit64,string)bytes`\n * @param appSpec The app spec for the app\n * @returns The `ABIMethod`\n */\nexport function getABIMethod(methodNameOrSignature: string, appSpec: Arc56Contract): ABIMethod {\n if (!methodNameOrSignature.includes('(')) {\n const methods = appSpec.methods.filter((m) => m.name === methodNameOrSignature)\n if (methods.length === 0) throw new Error(`Unable to find method ${methodNameOrSignature} in ${appSpec.name} app.`)\n if (methods.length > 1) {\n throw new Error(\n `Received a call to method ${methodNameOrSignature} in contract ${\n appSpec.name\n }, but this resolved to multiple methods; please pass in an ABI signature instead: ${appSpec.methods\n .map((m) => getArc56MethodSignature(m))\n .join(', ')}`,\n )\n }\n return arc56MethodToABIMethod(methods[0], appSpec)\n } else {\n const method = appSpec.methods.find((m) => getArc56MethodSignature(m) === methodNameOrSignature)\n if (!method) throw new Error(`Unable to find method ${methodNameOrSignature} in ${appSpec.name} app.`)\n return arc56MethodToABIMethod(method, appSpec)\n }\n}\n\nexport function arc56MethodToABIMethod(method: Arc56Method, appSpec: Arc56Contract): ABIMethod {\n if (typeof method.name !== 'string' || typeof method.returns !== 'object' || !Array.isArray(method.args)) {\n throw new Error('Invalid ABIMethod parameters')\n }\n\n const args = method.args.map(({ type, name, desc, struct, defaultValue }) => {\n const convertedDefaultValue: ABIDefaultValue | undefined = defaultValue\n ? {\n data: defaultValue.data,\n source: defaultValue.source as DefaultValueSource,\n type: defaultValue.type ? (isAVMType(defaultValue.type) ? defaultValue.type : ABIType.from(defaultValue.type)) : undefined,\n }\n : undefined\n\n if (argTypeIsTransaction(type as ABIMethodArgType) || argTypeIsReference(type as ABIMethodArgType)) {\n return {\n type: type as ABIMethodArgType,\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n }\n\n if (struct) {\n return {\n type: ABIStructType.fromStruct(struct, appSpec.structs),\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n }\n\n return {\n type: ABIType.from(type),\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n })\n\n const returns = {\n type:\n method.returns.type === ('void' as const)\n ? ('void' as const)\n : method.returns.struct\n ? ABIStructType.fromStruct(method.returns.struct, appSpec.structs)\n : ABIType.from(method.returns.type),\n desc: method.returns.desc,\n }\n\n return new ABIMethod({\n name: method.name,\n description: method.desc,\n args,\n returns,\n events: method.events,\n readonly: method.readonly,\n })\n}\n\nexport function argTypeIsTransaction(type: ABIMethodArgType): type is ABITransactionType {\n return (\n typeof type === 'string' &&\n (type === ABITransactionType.Txn ||\n type === ABITransactionType.Payment ||\n type === ABITransactionType.KeyRegistration ||\n type === ABITransactionType.AssetConfig ||\n type === ABITransactionType.AssetTransfer ||\n type === ABITransactionType.AssetFreeze ||\n type === ABITransactionType.AppCall)\n )\n}\n\nexport function argTypeIsReference(type: ABIMethodArgType): type is ABIReferenceType {\n return (\n typeof type === 'string' &&\n (type === ABIReferenceType.Account || type === ABIReferenceType.Application || type === ABIReferenceType.Asset)\n )\n}\n\nexport function argTypeIsAbiType(type: ABIMethodArgType): type is ABIType {\n return !argTypeIsTransaction(type) && !argTypeIsReference(type)\n}\n\nfunction getArc56MethodSignature(method: Arc56Method): string {\n const args = method.args.map((arg) => arg.type).join(',')\n const returns = method.returns.type\n return `${method.name}(${args})${returns}`\n}\n\nexport function decodeAVMValue(avmType: AVMType, bytes: Uint8Array): ABIValue {\n switch (avmType) {\n case 'AVMString':\n return Buffer.from(bytes).toString('utf-8')\n case 'AVMBytes':\n return bytes\n case 'AVMUint64':\n return ABIType.from('uint64').decode(bytes)\n }\n}\n\nexport function encodeAVMValue(avmType: AVMType, value: ABIValue): Uint8Array {\n switch (avmType) {\n case 'AVMString':\n return ABIType.from('string').encode(value)\n case 'AVMBytes':\n if (typeof value === 'string') return Buffer.from(value, 'utf-8')\n if (typeof value !== 'object' || !(value instanceof Uint8Array))\n throw new Error(`Expected bytes value for AVMBytes, but got ${value}`)\n return value\n case 'AVMUint64':\n return ABIType.from('uint64').encode(value)\n }\n}\n\nexport function isAVMType(type: unknown): type is AVMType {\n return typeof type === 'string' && (type === 'AVMString' || type === 'AVMBytes' || type === 'AVMUint64')\n}\n\nexport function getABIDecodedValue(type: AVMType | ABIType | ABIReferenceType, bytes: Uint8Array): ABIValue {\n if (type === ABIReferenceType.Asset || type === ABIReferenceType.Application) {\n return new ABIUintType(64).decode(bytes)\n } else if (type === ABIReferenceType.Account) {\n return new ABIAddressType().decode(bytes)\n } else if (isAVMType(type)) {\n return decodeAVMValue(type, bytes)\n }\n return type.decode(bytes)\n}\n\nexport function getABIEncodedValue(type: AVMType | ABIType, value: ABIValue): Uint8Array {\n return isAVMType(type) ? encodeAVMValue(type, value) : type.encode(value)\n}\n"],"mappings":";;;;;;AAMA,IAAY,oEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEF,IAAY,gEAAL;AACL;AACA;AACA;;;AAuDF,IAAa,YAAb,MAAa,UAAU;CACrB,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CAET,YAAY,QAOT;AACD,OAAK,OAAO,OAAO;AACnB,OAAK,cAAc,OAAO;AAC1B,OAAK,OAAO,OAAO;AACnB,OAAK,UAAU,OAAO;AACtB,OAAK,SAAS,OAAO;AACrB,OAAK,WAAW,OAAO;;;;;;CAOzB,eAAuB;EACrB,MAAM,OAAO,KAAK,KACf,KAAK,QAAQ;AACZ,OAAI,qBAAqB,IAAI,KAAK,IAAI,mBAAmB,IAAI,KAAK,CAAE,QAAO,IAAI;AAC/E,UAAO,IAAI,KAAK;IAChB,CACD,KAAK,IAAI;AAEZ,SAAO,GAAG,KAAK,KAAK,GAAG,KAAK,GADZ,KAAK,QAAQ,SAAS,SAAS,SAAS,KAAK,QAAQ,KAAK;;;;;;CAQ5E,cAA0B;EACxB,MAAM,OAAOA,kBAAO,WAAW,MAAM,KAAK,cAAc,CAAC;AACzD,SAAO,IAAI,WAAW,KAAK,MAAM,GAAG,EAAE,CAAC;;;;;;;;CASzC,OAAO,cAAc,WAA8B;EACjD,MAAM,YAAY,UAAU,QAAQ,IAAI;AACxC,MAAI,cAAc,GA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BAAiB,SAAS,SAAS,iBAAiB,YAC/D,QAAO,IAAIG,6BAAY,GAAG,CAAC,OAAO,MAAM;UAC/B,SAAS,iBAAiB,QACnC,QAAO,IAAIC,iCAAgB,CAAC,OAAO,MAAM;UAChC,UAAU,KAAK,CACxB,QAAO,eAAe,MAAM,MAAM;AAEpC,QAAO,KAAK,OAAO,MAAM;;AAG3B,SAAgB,mBAAmB,MAAyB,OAA6B;AACvF,QAAO,UAAU,KAAK,GAAG,eAAe,MAAM,MAAM,GAAG,KAAK,OAAO,MAAM"}
1
+ {"version":3,"file":"abi-method.js","names":["sha512","parseTupleContent","ABIType","convertedDefaultValue: ABIDefaultValue | undefined","ABIStructType","ABIUintType","ABIAddressType"],"sources":["../../../../packages/abi/src/abi-method.ts"],"sourcesContent":["import sha512 from 'js-sha512'\nimport { ABIAddressType, ABIStructType, ABIType, ABIUintType, parseTupleContent } from './abi-type'\nimport { ABIValue } from './abi-value'\nimport { ARC28Event } from './arc28-event'\nimport { AVMType, Arc56Contract, Arc56Method } from './arc56-contract'\n\nexport enum ABITransactionType {\n Txn = 'txn',\n Payment = 'pay',\n KeyRegistration = 'keyreg',\n AssetConfig = 'acfg',\n AssetTransfer = 'axfer',\n AssetFreeze = 'afrz',\n AppCall = 'appl',\n}\nexport enum ABIReferenceType {\n Account = 'account',\n Application = 'application',\n Asset = 'asset',\n}\nexport type ABIMethodArgType = ABIType | ABITransactionType | ABIReferenceType\nexport type ABIMethodReturnType = ABIType | 'void'\n\nexport type ABIMethodArg = {\n type: ABIMethodArgType\n name?: string\n description?: string\n defaultValue?: ABIDefaultValue\n}\n\nexport type ABIMethodReturn = {\n type: ABIMethodReturnType\n description?: string\n}\n\nexport type ABIDefaultValue = {\n /** Base64 encoded bytes, base64 ARC4 encoded uint64, or UTF-8 method selector */\n data: string\n /** Where the default value is coming from */\n source: DefaultValueSource\n /** How the data is encoded. This is the encoding for the data provided here, not the arg type */\n type?: ABIType | AVMType\n}\n\nexport enum DefaultValueSource {\n Box = 'box',\n Global = 'global',\n Local = 'local',\n Literal = 'literal',\n Method = 'method',\n}\n\n/** Represents an ABI method return value with parsed data. */\nexport type ABIReturn =\n | {\n /** The method that was called. */\n method: ABIMethod\n /** The raw return value as bytes.\n *\n * This is the value from the last app call log with the first 4 bytes (the ABI return prefix) omitted.\n */\n rawReturnValue: Uint8Array\n /** The parsed ABI return value. */\n returnValue: ABIValue\n decodeError: undefined\n }\n | { rawReturnValue?: undefined; returnValue?: undefined; method: ABIMethod; decodeError?: Error }\n\n/** Decoded ARC-56 struct as a struct rather than a tuple. */\nexport type ABIStruct = {\n [key: string]: ABIStruct | ABIValue\n}\n\nexport class ABIMethod {\n readonly name: string\n readonly description?: string\n readonly args: ABIMethodArg[]\n readonly returns: ABIMethodReturn\n readonly events?: ARC28Event[]\n readonly readonly?: boolean\n\n constructor(params: {\n name: string\n description?: string\n args: ABIMethodArg[]\n returns: ABIMethodReturn\n events?: ARC28Event[]\n readonly?: boolean\n }) {\n this.name = params.name\n this.description = params.description\n this.args = params.args\n this.returns = params.returns\n this.events = params.events\n this.readonly = params.readonly\n }\n\n /**\n * Returns the signature of this ABI method.\n * @returns The signature, e.g. `my_method(unit64,string)bytes`\n */\n getSignature(): string {\n const args = this.args\n .map((arg) => {\n if (argTypeIsTransaction(arg.type) || argTypeIsReference(arg.type)) return arg.type\n return arg.type.name\n })\n .join(',')\n const returns = this.returns.type === 'void' ? 'void' : this.returns.type.name\n return `${this.name}(${args})${returns}`\n }\n\n /**\n * Returns the method selector of this ABI method.\n * @returns The 4-byte method selector\n */\n getSelector(): Uint8Array {\n const hash = sha512.sha512_256.array(this.getSignature())\n return new Uint8Array(hash.slice(0, 4))\n }\n\n /**\n * Returns the ABI method object for a given method signature.\n * @param signature The method signature\n * e.g. `my_method(unit64,string)bytes`\n * @returns The `ABIMethod`\n */\n static fromSignature(signature: string): ABIMethod {\n const argsStart = signature.indexOf('(')\n if (argsStart === -1) {\n throw new Error(`Invalid method signature: ${signature}`)\n }\n\n let argsEnd = -1\n let depth = 0\n for (let i = argsStart; i < signature.length; i++) {\n const char = signature[i]\n\n if (char === '(') {\n depth += 1\n } else if (char === ')') {\n if (depth === 0) {\n // unpaired parenthesis\n break\n }\n\n depth -= 1\n if (depth === 0) {\n argsEnd = i\n break\n }\n }\n }\n\n if (argsEnd === -1) {\n throw new Error(`Invalid method signature: ${signature}`)\n }\n\n const name = signature.slice(0, argsStart)\n const args = parseTupleContent(signature.slice(argsStart + 1, argsEnd)).map((n: string) => {\n if (argTypeIsTransaction(n as ABIMethodArgType) || argTypeIsReference(n as ABIMethodArgType)) {\n return { type: n as ABIMethodArgType } satisfies ABIMethodArg\n }\n return { type: ABIType.from(n) } satisfies ABIMethodArg\n })\n const returnType = signature.slice(argsEnd + 1)\n const returns = { type: returnType === 'void' ? ('void' as const) : ABIType.from(returnType) } satisfies ABIMethodReturn\n\n return new ABIMethod({\n name,\n args,\n returns,\n })\n }\n}\n\n/**\n * Returns the ABI method object for a given method name or signature and ARC-56 app spec.\n * @param methodNameOrSignature The method name or method signature to call if an ABI call is being emitted.\n * e.g. `my_method` or `my_method(unit64,string)bytes`\n * @param appSpec The app spec for the app\n * @returns The `ABIMethod`\n */\nexport function getABIMethod(methodNameOrSignature: string, appSpec: Arc56Contract): ABIMethod {\n if (!methodNameOrSignature.includes('(')) {\n const methods = appSpec.methods.filter((m) => m.name === methodNameOrSignature)\n if (methods.length === 0) throw new Error(`Unable to find method ${methodNameOrSignature} in ${appSpec.name} app.`)\n if (methods.length > 1) {\n throw new Error(\n `Received a call to method ${methodNameOrSignature} in contract ${\n appSpec.name\n }, but this resolved to multiple methods; please pass in an ABI signature instead: ${appSpec.methods\n .map((m) => getArc56MethodSignature(m))\n .join(', ')}`,\n )\n }\n return arc56MethodToABIMethod(methods[0], appSpec)\n } else {\n const method = appSpec.methods.find((m) => getArc56MethodSignature(m) === methodNameOrSignature)\n if (!method) throw new Error(`Unable to find method ${methodNameOrSignature} in ${appSpec.name} app.`)\n return arc56MethodToABIMethod(method, appSpec)\n }\n}\n\nexport function arc56MethodToABIMethod(method: Arc56Method, appSpec: Arc56Contract): ABIMethod {\n if (typeof method.name !== 'string' || typeof method.returns !== 'object' || !Array.isArray(method.args)) {\n throw new Error('Invalid ABIMethod parameters')\n }\n\n const args = method.args.map(({ type, name, desc, struct, defaultValue }) => {\n const convertedDefaultValue: ABIDefaultValue | undefined = defaultValue\n ? {\n data: defaultValue.data,\n source: defaultValue.source as DefaultValueSource,\n type: defaultValue.type ? (isAVMType(defaultValue.type) ? defaultValue.type : ABIType.from(defaultValue.type)) : undefined,\n }\n : undefined\n\n if (argTypeIsTransaction(type as ABIMethodArgType) || argTypeIsReference(type as ABIMethodArgType)) {\n return {\n type: type as ABIMethodArgType,\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n }\n\n if (struct) {\n return {\n type: ABIStructType.fromStruct(struct, appSpec.structs),\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n }\n\n return {\n type: ABIType.from(type),\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n })\n\n const returns = {\n type:\n method.returns.type === ('void' as const)\n ? ('void' as const)\n : method.returns.struct\n ? ABIStructType.fromStruct(method.returns.struct, appSpec.structs)\n : ABIType.from(method.returns.type),\n desc: method.returns.desc,\n }\n\n return new ABIMethod({\n name: method.name,\n description: method.desc,\n args,\n returns,\n events: method.events,\n readonly: method.readonly,\n })\n}\n\nexport function argTypeIsTransaction(type: ABIMethodArgType): type is ABITransactionType {\n return (\n typeof type === 'string' &&\n (type === ABITransactionType.Txn ||\n type === ABITransactionType.Payment ||\n type === ABITransactionType.KeyRegistration ||\n type === ABITransactionType.AssetConfig ||\n type === ABITransactionType.AssetTransfer ||\n type === ABITransactionType.AssetFreeze ||\n type === ABITransactionType.AppCall)\n )\n}\n\nexport function argTypeIsReference(type: ABIMethodArgType): type is ABIReferenceType {\n return (\n typeof type === 'string' &&\n (type === ABIReferenceType.Account || type === ABIReferenceType.Application || type === ABIReferenceType.Asset)\n )\n}\n\nexport function argTypeIsAbiType(type: ABIMethodArgType): type is ABIType {\n return !argTypeIsTransaction(type) && !argTypeIsReference(type)\n}\n\nfunction getArc56MethodSignature(method: Arc56Method): string {\n const args = method.args.map((arg) => arg.type).join(',')\n const returns = method.returns.type\n return `${method.name}(${args})${returns}`\n}\n\nexport function decodeAVMValue(avmType: AVMType, bytes: Uint8Array): ABIValue {\n switch (avmType) {\n case 'AVMString':\n return Buffer.from(bytes).toString('utf-8')\n case 'AVMBytes':\n return bytes\n case 'AVMUint64':\n return ABIType.from('uint64').decode(bytes)\n }\n}\n\nexport function encodeAVMValue(avmType: AVMType, value: ABIValue): Uint8Array {\n switch (avmType) {\n case 'AVMString':\n return ABIType.from('string').encode(value)\n case 'AVMBytes':\n if (typeof value === 'string') return Buffer.from(value, 'utf-8')\n if (typeof value !== 'object' || !(value instanceof Uint8Array))\n throw new Error(`Expected bytes value for AVMBytes, but got ${value}`)\n return value\n case 'AVMUint64':\n return ABIType.from('uint64').encode(value)\n }\n}\n\nexport function isAVMType(type: unknown): type is AVMType {\n return typeof type === 'string' && (type === 'AVMString' || type === 'AVMBytes' || type === 'AVMUint64')\n}\n\nexport function getABIDecodedValue(type: AVMType | ABIType | ABIReferenceType, bytes: Uint8Array): ABIValue {\n if (type === ABIReferenceType.Asset || type === ABIReferenceType.Application) {\n return new ABIUintType(64).decode(bytes)\n } else if (type === ABIReferenceType.Account) {\n return new ABIAddressType().decode(bytes)\n } else if (isAVMType(type)) {\n return decodeAVMValue(type, bytes)\n }\n return type.decode(bytes)\n}\n\nexport function getABIEncodedValue(type: AVMType | ABIType, value: ABIValue): Uint8Array {\n return isAVMType(type) ? encodeAVMValue(type, value) : type.encode(value)\n}\n"],"mappings":";;;;;;AAMA,IAAY,oEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEF,IAAY,gEAAL;AACL;AACA;AACA;;;AAuD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AI;AAEzD,QAAO,GAAG,OAAO,KAAK,GAAG,KAAK,GADd,OAAO,QAAQ;;AAIjC,SAAgB,eAAe,SAAkB,OAA6B;AAC5E,SAAQ,SAAR;EACE,KAAK,YACH,QAAO,OAAO,KAAK,MAAM,CAAC,SAAS,QAAQ;EAC7C,KAAK,WACH,QAAO;EACT,KAAK,YACH,QAAOA,yBAAQ,KAAK,SAAS,CAAC,OAAO,MAAM;;;AAIjD,SAAgB,eAAe,SAAkB,OAA6B;AAC5E,SAAQ,SAAR;EACE,KAAK,YACH,QAAOA,yBAAQ,KAAK,SAAS,CAAC,OAAO,MAAM;EAC7C,KAAK;AACH,OAAI,OAAO,UAAU,SAAU,QAAO,OAAO,KAAK,OAAO,QAAQ;AACjE,OAAI,OAAO,UAAU,YAAY,EAAE,iBAAiB,YAClD,OAAM,IAAI,MAAM,8CAA8C,QAAQ;AACxE,UAAO;EACT,KAAK,YACH,QAAOA,yBAAQ,KAAK,SAAS,CAAC,OAAO,MAAM;;;AAIjD,SAAgB,UAAU,MAAgC;AACxD,QAAO,OAAO,SAAS,aAAa,SAAS,eAAe,SAAS,cAAc,SAAS;;AAG9F,SAAgB,mBAAmB,MAA4C,OAA6B;AAC1G,KAAI,SAAS,iBAAiB,SAAS,SAAS,iBAAiB,YAC/D,QAAO,IAAIG,6BAAY,GAAG,CAAC,OAAO,MAAM;UAC/B,SAAS,iBAAiB,QACnC,QAAO,IAAIC,iCAAgB,CAAC,OAAO,MAAM;UAChC,UAAU,KAAK,CACxB,QAAO,eAAe,MAAM,MAAM;AAEpC,QAAO,KAAK,OAAO,MAAM;;AAG3B,SAAgB,mBAAmB,MAAyB,OAA6B;AACvF,QAAO,UAAU,KAAK,GAAG,eAAe,MAAM,MAAM,GAAG,KAAK,OAAO,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"abi-method.mjs","names":["convertedDefaultValue: ABIDefaultValue | undefined"],"sources":["../../../../packages/abi/src/abi-method.ts"],"sourcesContent":["import sha512 from 'js-sha512'\nimport { ABIAddressType, ABIStructType, ABIType, ABIUintType, parseTupleContent } from './abi-type'\nimport { ABIValue } from './abi-value'\nimport { ARC28Event } from './arc28-event'\nimport { AVMType, Arc56Contract, Arc56Method } from './arc56-contract'\n\nexport enum ABITransactionType {\n Txn = 'txn',\n Payment = 'pay',\n KeyRegistration = 'keyreg',\n AssetConfig = 'acfg',\n AssetTransfer = 'axfer',\n AssetFreeze = 'afrz',\n AppCall = 'appl',\n}\nexport enum ABIReferenceType {\n Account = 'account',\n Application = 'application',\n Asset = 'asset',\n}\nexport type ABIMethodArgType = ABIType | ABITransactionType | ABIReferenceType\nexport type ABIMethodReturnType = ABIType | 'void'\n\nexport type ABIMethodArg = {\n type: ABIMethodArgType\n name?: string\n description?: string\n defaultValue?: ABIDefaultValue\n}\n\nexport type ABIMethodReturn = {\n type: ABIMethodReturnType\n description?: string\n}\n\nexport type ABIDefaultValue = {\n /** Base64 encoded bytes, base64 ARC4 encoded uint64, or UTF-8 method selector */\n data: string\n /** Where the default value is coming from */\n source: DefaultValueSource\n /** How the data is encoded. This is the encoding for the data provided here, not the arg type */\n type?: ABIType | AVMType\n}\n\nexport enum DefaultValueSource {\n Box = 'box',\n Global = 'global',\n Local = 'local',\n Literal = 'literal',\n Method = 'method',\n}\n\n/** Represents an ABI method return value with parsed data. */\nexport type ABIReturn =\n | {\n /** The method that was called. */\n method: ABIMethod\n /** The raw return value as bytes.\n *\n * This is the value from the last app call log with the first 4 bytes (the ABI return prefix) omitted.\n */\n rawReturnValue: Uint8Array\n /** The parsed ABI return value. */\n returnValue: ABIValue\n decodeError: undefined\n }\n | { rawReturnValue?: undefined; returnValue?: undefined; method: ABIMethod; decodeError: Error }\n\n/** Decoded ARC-56 struct as a struct rather than a tuple. */\nexport type ABIStruct = {\n [key: string]: ABIStruct | ABIValue\n}\n\nexport class ABIMethod {\n readonly name: string\n readonly description?: string\n readonly args: ABIMethodArg[]\n readonly returns: ABIMethodReturn\n readonly events?: ARC28Event[]\n readonly readonly?: boolean\n\n constructor(params: {\n name: string\n description?: string\n args: ABIMethodArg[]\n returns: ABIMethodReturn\n events?: ARC28Event[]\n readonly?: boolean\n }) {\n this.name = params.name\n this.description = params.description\n this.args = params.args\n this.returns = params.returns\n this.events = params.events\n this.readonly = params.readonly\n }\n\n /**\n * Returns the signature of this ABI method.\n * @returns The signature, e.g. `my_method(unit64,string)bytes`\n */\n getSignature(): string {\n const args = this.args\n .map((arg) => {\n if (argTypeIsTransaction(arg.type) || argTypeIsReference(arg.type)) return arg.type\n return arg.type.name\n })\n .join(',')\n const returns = this.returns.type === 'void' ? 'void' : this.returns.type.name\n return `${this.name}(${args})${returns}`\n }\n\n /**\n * Returns the method selector of this ABI method.\n * @returns The 4-byte method selector\n */\n getSelector(): Uint8Array {\n const hash = sha512.sha512_256.array(this.getSignature())\n return new Uint8Array(hash.slice(0, 4))\n }\n\n /**\n * Returns the ABI method object for a given method signature.\n * @param signature The method signature\n * e.g. `my_method(unit64,string)bytes`\n * @returns The `ABIMethod`\n */\n static fromSignature(signature: string): ABIMethod {\n const argsStart = signature.indexOf('(')\n if (argsStart === -1) {\n throw new Error(`Invalid method signature: ${signature}`)\n }\n\n let argsEnd = -1\n let depth = 0\n for (let i = argsStart; i < signature.length; i++) {\n const char = signature[i]\n\n if (char === '(') {\n depth += 1\n } else if (char === ')') {\n if (depth === 0) {\n // unpaired parenthesis\n break\n }\n\n depth -= 1\n if (depth === 0) {\n argsEnd = i\n break\n }\n }\n }\n\n if (argsEnd === -1) {\n throw new Error(`Invalid method signature: ${signature}`)\n }\n\n const name = signature.slice(0, argsStart)\n const args = parseTupleContent(signature.slice(argsStart + 1, argsEnd)).map((n: string) => {\n if (argTypeIsTransaction(n as ABIMethodArgType) || argTypeIsReference(n as ABIMethodArgType)) {\n return { type: n as ABIMethodArgType } satisfies ABIMethodArg\n }\n return { type: ABIType.from(n) } satisfies ABIMethodArg\n })\n const returnType = signature.slice(argsEnd + 1)\n const returns = { type: returnType === 'void' ? ('void' as const) : ABIType.from(returnType) } satisfies ABIMethodReturn\n\n return new ABIMethod({\n name,\n args,\n returns,\n })\n }\n}\n\n/**\n * Returns the ABI method object for a given method name or signature and ARC-56 app spec.\n * @param methodNameOrSignature The method name or method signature to call if an ABI call is being emitted.\n * e.g. `my_method` or `my_method(unit64,string)bytes`\n * @param appSpec The app spec for the app\n * @returns The `ABIMethod`\n */\nexport function getABIMethod(methodNameOrSignature: string, appSpec: Arc56Contract): ABIMethod {\n if (!methodNameOrSignature.includes('(')) {\n const methods = appSpec.methods.filter((m) => m.name === methodNameOrSignature)\n if (methods.length === 0) throw new Error(`Unable to find method ${methodNameOrSignature} in ${appSpec.name} app.`)\n if (methods.length > 1) {\n throw new Error(\n `Received a call to method ${methodNameOrSignature} in contract ${\n appSpec.name\n }, but this resolved to multiple methods; please pass in an ABI signature instead: ${appSpec.methods\n .map((m) => getArc56MethodSignature(m))\n .join(', ')}`,\n )\n }\n return arc56MethodToABIMethod(methods[0], appSpec)\n } else {\n const method = appSpec.methods.find((m) => getArc56MethodSignature(m) === methodNameOrSignature)\n if (!method) throw new Error(`Unable to find method ${methodNameOrSignature} in ${appSpec.name} app.`)\n return arc56MethodToABIMethod(method, appSpec)\n }\n}\n\nexport function arc56MethodToABIMethod(method: Arc56Method, appSpec: Arc56Contract): ABIMethod {\n if (typeof method.name !== 'string' || typeof method.returns !== 'object' || !Array.isArray(method.args)) {\n throw new Error('Invalid ABIMethod parameters')\n }\n\n const args = method.args.map(({ type, name, desc, struct, defaultValue }) => {\n const convertedDefaultValue: ABIDefaultValue | undefined = defaultValue\n ? {\n data: defaultValue.data,\n source: defaultValue.source as DefaultValueSource,\n type: defaultValue.type ? (isAVMType(defaultValue.type) ? defaultValue.type : ABIType.from(defaultValue.type)) : undefined,\n }\n : undefined\n\n if (argTypeIsTransaction(type as ABIMethodArgType) || argTypeIsReference(type as ABIMethodArgType)) {\n return {\n type: type as ABIMethodArgType,\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n }\n\n if (struct) {\n return {\n type: ABIStructType.fromStruct(struct, appSpec.structs),\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n }\n\n return {\n type: ABIType.from(type),\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n })\n\n const returns = {\n type:\n method.returns.type === ('void' as const)\n ? ('void' as const)\n : method.returns.struct\n ? ABIStructType.fromStruct(method.returns.struct, appSpec.structs)\n : ABIType.from(method.returns.type),\n desc: method.returns.desc,\n }\n\n return new ABIMethod({\n name: method.name,\n description: method.desc,\n args,\n returns,\n events: method.events,\n readonly: method.readonly,\n })\n}\n\nexport function argTypeIsTransaction(type: ABIMethodArgType): type is ABITransactionType {\n return (\n typeof type === 'string' &&\n (type === ABITransactionType.Txn ||\n type === ABITransactionType.Payment ||\n type === ABITransactionType.KeyRegistration ||\n type === ABITransactionType.AssetConfig ||\n type === ABITransactionType.AssetTransfer ||\n type === ABITransactionType.AssetFreeze ||\n type === ABITransactionType.AppCall)\n )\n}\n\nexport function argTypeIsReference(type: ABIMethodArgType): type is ABIReferenceType {\n return (\n typeof type === 'string' &&\n (type === ABIReferenceType.Account || type === ABIReferenceType.Application || type === ABIReferenceType.Asset)\n )\n}\n\nexport function argTypeIsAbiType(type: ABIMethodArgType): type is ABIType {\n return !argTypeIsTransaction(type) && !argTypeIsReference(type)\n}\n\nfunction getArc56MethodSignature(method: Arc56Method): string {\n const args = method.args.map((arg) => arg.type).join(',')\n const returns = method.returns.type\n return `${method.name}(${args})${returns}`\n}\n\nexport function decodeAVMValue(avmType: AVMType, bytes: Uint8Array): ABIValue {\n switch (avmType) {\n case 'AVMString':\n return Buffer.from(bytes).toString('utf-8')\n case 'AVMBytes':\n return bytes\n case 'AVMUint64':\n return ABIType.from('uint64').decode(bytes)\n }\n}\n\nexport function encodeAVMValue(avmType: AVMType, value: ABIValue): Uint8Array {\n switch (avmType) {\n case 'AVMString':\n return ABIType.from('string').encode(value)\n case 'AVMBytes':\n if (typeof value === 'string') return Buffer.from(value, 'utf-8')\n if (typeof value !== 'object' || !(value instanceof Uint8Array))\n throw new Error(`Expected bytes value for AVMBytes, but got ${value}`)\n return value\n case 'AVMUint64':\n return ABIType.from('uint64').encode(value)\n }\n}\n\nexport function isAVMType(type: unknown): type is AVMType {\n return typeof type === 'string' && (type === 'AVMString' || type === 'AVMBytes' || type === 'AVMUint64')\n}\n\nexport function getABIDecodedValue(type: AVMType | ABIType | ABIReferenceType, bytes: Uint8Array): ABIValue {\n if (type === ABIReferenceType.Asset || type === ABIReferenceType.Application) {\n return new ABIUintType(64).decode(bytes)\n } else if (type === ABIReferenceType.Account) {\n return new ABIAddressType().decode(bytes)\n } else if (isAVMType(type)) {\n return decodeAVMValue(type, bytes)\n }\n return type.decode(bytes)\n}\n\nexport function getABIEncodedValue(type: AVMType | ABIType, value: ABIValue): Uint8Array {\n return isAVMType(type) ? encodeAVMValue(type, value) : type.encode(value)\n}\n"],"mappings":";;;;AAMA,IAAY,oEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEF,IAAY,gEAAL;AACL;AACA;AACA;;;AAuDF,IAAa,YAAb,MAAa,UAAU;CACrB,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CAET,YAAY,QAOT;AACD,OAAK,OAAO,OAAO;AACnB,OAAK,cAAc,OAAO;AAC1B,OAAK,OAAO,OAAO;AACnB,OAAK,UAAU,OAAO;AACtB,OAAK,SAAS,OAAO;AACrB,OAAK,WAAW,OAAO;;;;;;CAOzB,eAAuB;EACrB,MAAM,OAAO,KAAK,KACf,KAAK,QAAQ;AACZ,OAAI,qBAAqB,IAAI,KAAK,IAAI,mBAAmB,IAAI,KAAK,CAAE,QAAO,IAAI;AAC/E,UAAO,IAAI,KAAK;IAChB,CACD,KAAK,IAAI;AAEZ,SAAO,GAAG,KAAK,KAAK,GAAG,KAAK,GADZ,KAAK,QAAQ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,8CAA8C,QAAQ;AACxE,UAAO;EACT,KAAK,YACH,QAAO,QAAQ,KAAK,SAAS,CAAC,OAAO,MAAM;;;AAIjD,SAAgB,UAAU,MAAgC;AACxD,QAAO,OAAO,SAAS,aAAa,SAAS,eAAe,SAAS,cAAc,SAAS;;AAG9F,SAAgB,mBAAmB,MAA4C,OAA6B;AAC1G,KAAI,SAAS,iBAAiB,SAAS,SAAS,iBAAiB,YAC/D,QAAO,IAAI,YAAY,GAAG,CAAC,OAAO,MAAM;UAC/B,SAAS,iBAAiB,QACnC,QAAO,IAAI,gBAAgB,CAAC,OAAO,MAAM;UAChC,UAAU,KAAK,CACxB,QAAO,eAAe,MAAM,MAAM;AAEpC,QAAO,KAAK,OAAO,MAAM;;AAG3B,SAAgB,mBAAmB,MAAyB,OAA6B;AACvF,QAAO,UAAU,KAAK,GAAG,eAAe,MAAM,MAAM,GAAG,KAAK,OAAO,MAAM"}
1
+ {"version":3,"file":"abi-method.mjs","names":["convertedDefaultValue: ABIDefaultValue | undefined"],"sources":["../../../../packages/abi/src/abi-method.ts"],"sourcesContent":["import sha512 from 'js-sha512'\nimport { ABIAddressType, ABIStructType, ABIType, ABIUintType, parseTupleContent } from './abi-type'\nimport { ABIValue } from './abi-value'\nimport { ARC28Event } from './arc28-event'\nimport { AVMType, Arc56Contract, Arc56Method } from './arc56-contract'\n\nexport enum ABITransactionType {\n Txn = 'txn',\n Payment = 'pay',\n KeyRegistration = 'keyreg',\n AssetConfig = 'acfg',\n AssetTransfer = 'axfer',\n AssetFreeze = 'afrz',\n AppCall = 'appl',\n}\nexport enum ABIReferenceType {\n Account = 'account',\n Application = 'application',\n Asset = 'asset',\n}\nexport type ABIMethodArgType = ABIType | ABITransactionType | ABIReferenceType\nexport type ABIMethodReturnType = ABIType | 'void'\n\nexport type ABIMethodArg = {\n type: ABIMethodArgType\n name?: string\n description?: string\n defaultValue?: ABIDefaultValue\n}\n\nexport type ABIMethodReturn = {\n type: ABIMethodReturnType\n description?: string\n}\n\nexport type ABIDefaultValue = {\n /** Base64 encoded bytes, base64 ARC4 encoded uint64, or UTF-8 method selector */\n data: string\n /** Where the default value is coming from */\n source: DefaultValueSource\n /** How the data is encoded. This is the encoding for the data provided here, not the arg type */\n type?: ABIType | AVMType\n}\n\nexport enum DefaultValueSource {\n Box = 'box',\n Global = 'global',\n Local = 'local',\n Literal = 'literal',\n Method = 'method',\n}\n\n/** Represents an ABI method return value with parsed data. */\nexport type ABIReturn =\n | {\n /** The method that was called. */\n method: ABIMethod\n /** The raw return value as bytes.\n *\n * This is the value from the last app call log with the first 4 bytes (the ABI return prefix) omitted.\n */\n rawReturnValue: Uint8Array\n /** The parsed ABI return value. */\n returnValue: ABIValue\n decodeError: undefined\n }\n | { rawReturnValue?: undefined; returnValue?: undefined; method: ABIMethod; decodeError?: Error }\n\n/** Decoded ARC-56 struct as a struct rather than a tuple. */\nexport type ABIStruct = {\n [key: string]: ABIStruct | ABIValue\n}\n\nexport class ABIMethod {\n readonly name: string\n readonly description?: string\n readonly args: ABIMethodArg[]\n readonly returns: ABIMethodReturn\n readonly events?: ARC28Event[]\n readonly readonly?: boolean\n\n constructor(params: {\n name: string\n description?: string\n args: ABIMethodArg[]\n returns: ABIMethodReturn\n events?: ARC28Event[]\n readonly?: boolean\n }) {\n this.name = params.name\n this.description = params.description\n this.args = params.args\n this.returns = params.returns\n this.events = params.events\n this.readonly = params.readonly\n }\n\n /**\n * Returns the signature of this ABI method.\n * @returns The signature, e.g. `my_method(unit64,string)bytes`\n */\n getSignature(): string {\n const args = this.args\n .map((arg) => {\n if (argTypeIsTransaction(arg.type) || argTypeIsReference(arg.type)) return arg.type\n return arg.type.name\n })\n .join(',')\n const returns = this.returns.type === 'void' ? 'void' : this.returns.type.name\n return `${this.name}(${args})${returns}`\n }\n\n /**\n * Returns the method selector of this ABI method.\n * @returns The 4-byte method selector\n */\n getSelector(): Uint8Array {\n const hash = sha512.sha512_256.array(this.getSignature())\n return new Uint8Array(hash.slice(0, 4))\n }\n\n /**\n * Returns the ABI method object for a given method signature.\n * @param signature The method signature\n * e.g. `my_method(unit64,string)bytes`\n * @returns The `ABIMethod`\n */\n static fromSignature(signature: string): ABIMethod {\n const argsStart = signature.indexOf('(')\n if (argsStart === -1) {\n throw new Error(`Invalid method signature: ${signature}`)\n }\n\n let argsEnd = -1\n let depth = 0\n for (let i = argsStart; i < signature.length; i++) {\n const char = signature[i]\n\n if (char === '(') {\n depth += 1\n } else if (char === ')') {\n if (depth === 0) {\n // unpaired parenthesis\n break\n }\n\n depth -= 1\n if (depth === 0) {\n argsEnd = i\n break\n }\n }\n }\n\n if (argsEnd === -1) {\n throw new Error(`Invalid method signature: ${signature}`)\n }\n\n const name = signature.slice(0, argsStart)\n const args = parseTupleContent(signature.slice(argsStart + 1, argsEnd)).map((n: string) => {\n if (argTypeIsTransaction(n as ABIMethodArgType) || argTypeIsReference(n as ABIMethodArgType)) {\n return { type: n as ABIMethodArgType } satisfies ABIMethodArg\n }\n return { type: ABIType.from(n) } satisfies ABIMethodArg\n })\n const returnType = signature.slice(argsEnd + 1)\n const returns = { type: returnType === 'void' ? ('void' as const) : ABIType.from(returnType) } satisfies ABIMethodReturn\n\n return new ABIMethod({\n name,\n args,\n returns,\n })\n }\n}\n\n/**\n * Returns the ABI method object for a given method name or signature and ARC-56 app spec.\n * @param methodNameOrSignature The method name or method signature to call if an ABI call is being emitted.\n * e.g. `my_method` or `my_method(unit64,string)bytes`\n * @param appSpec The app spec for the app\n * @returns The `ABIMethod`\n */\nexport function getABIMethod(methodNameOrSignature: string, appSpec: Arc56Contract): ABIMethod {\n if (!methodNameOrSignature.includes('(')) {\n const methods = appSpec.methods.filter((m) => m.name === methodNameOrSignature)\n if (methods.length === 0) throw new Error(`Unable to find method ${methodNameOrSignature} in ${appSpec.name} app.`)\n if (methods.length > 1) {\n throw new Error(\n `Received a call to method ${methodNameOrSignature} in contract ${\n appSpec.name\n }, but this resolved to multiple methods; please pass in an ABI signature instead: ${appSpec.methods\n .map((m) => getArc56MethodSignature(m))\n .join(', ')}`,\n )\n }\n return arc56MethodToABIMethod(methods[0], appSpec)\n } else {\n const method = appSpec.methods.find((m) => getArc56MethodSignature(m) === methodNameOrSignature)\n if (!method) throw new Error(`Unable to find method ${methodNameOrSignature} in ${appSpec.name} app.`)\n return arc56MethodToABIMethod(method, appSpec)\n }\n}\n\nexport function arc56MethodToABIMethod(method: Arc56Method, appSpec: Arc56Contract): ABIMethod {\n if (typeof method.name !== 'string' || typeof method.returns !== 'object' || !Array.isArray(method.args)) {\n throw new Error('Invalid ABIMethod parameters')\n }\n\n const args = method.args.map(({ type, name, desc, struct, defaultValue }) => {\n const convertedDefaultValue: ABIDefaultValue | undefined = defaultValue\n ? {\n data: defaultValue.data,\n source: defaultValue.source as DefaultValueSource,\n type: defaultValue.type ? (isAVMType(defaultValue.type) ? defaultValue.type : ABIType.from(defaultValue.type)) : undefined,\n }\n : undefined\n\n if (argTypeIsTransaction(type as ABIMethodArgType) || argTypeIsReference(type as ABIMethodArgType)) {\n return {\n type: type as ABIMethodArgType,\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n }\n\n if (struct) {\n return {\n type: ABIStructType.fromStruct(struct, appSpec.structs),\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n }\n\n return {\n type: ABIType.from(type),\n name,\n description: desc,\n defaultValue: convertedDefaultValue,\n } satisfies ABIMethodArg\n })\n\n const returns = {\n type:\n method.returns.type === ('void' as const)\n ? ('void' as const)\n : method.returns.struct\n ? ABIStructType.fromStruct(method.returns.struct, appSpec.structs)\n : ABIType.from(method.returns.type),\n desc: method.returns.desc,\n }\n\n return new ABIMethod({\n name: method.name,\n description: method.desc,\n args,\n returns,\n events: method.events,\n readonly: method.readonly,\n })\n}\n\nexport function argTypeIsTransaction(type: ABIMethodArgType): type is ABITransactionType {\n return (\n typeof type === 'string' &&\n (type === ABITransactionType.Txn ||\n type === ABITransactionType.Payment ||\n type === ABITransactionType.KeyRegistration ||\n type === ABITransactionType.AssetConfig ||\n type === ABITransactionType.AssetTransfer ||\n type === ABITransactionType.AssetFreeze ||\n type === ABITransactionType.AppCall)\n )\n}\n\nexport function argTypeIsReference(type: ABIMethodArgType): type is ABIReferenceType {\n return (\n typeof type === 'string' &&\n (type === ABIReferenceType.Account || type === ABIReferenceType.Application || type === ABIReferenceType.Asset)\n )\n}\n\nexport function argTypeIsAbiType(type: ABIMethodArgType): type is ABIType {\n return !argTypeIsTransaction(type) && !argTypeIsReference(type)\n}\n\nfunction getArc56MethodSignature(method: Arc56Method): string {\n const args = method.args.map((arg) => arg.type).join(',')\n const returns = method.returns.type\n return `${method.name}(${args})${returns}`\n}\n\nexport function decodeAVMValue(avmType: AVMType, bytes: Uint8Array): ABIValue {\n switch (avmType) {\n case 'AVMString':\n return Buffer.from(bytes).toString('utf-8')\n case 'AVMBytes':\n return bytes\n case 'AVMUint64':\n return ABIType.from('uint64').decode(bytes)\n }\n}\n\nexport function encodeAVMValue(avmType: AVMType, value: ABIValue): Uint8Array {\n switch (avmType) {\n case 'AVMString':\n return ABIType.from('string').encode(value)\n case 'AVMBytes':\n if (typeof value === 'string') return Buffer.from(value, 'utf-8')\n if (typeof value !== 'object' || !(value instanceof Uint8Array))\n throw new Error(`Expected bytes value for AVMBytes, but got ${value}`)\n return value\n case 'AVMUint64':\n return ABIType.from('uint64').encode(value)\n }\n}\n\nexport function isAVMType(type: unknown): type is AVMType {\n return typeof type === 'string' && (type === 'AVMString' || type === 'AVMBytes' || type === 'AVMUint64')\n}\n\nexport function getABIDecodedValue(type: AVMType | ABIType | ABIReferenceType, bytes: Uint8Array): ABIValue {\n if (type === ABIReferenceType.Asset || type === ABIReferenceType.Application) {\n return new ABIUintType(64).decode(bytes)\n } else if (type === ABIReferenceType.Account) {\n return new ABIAddressType().decode(bytes)\n } else if (isAVMType(type)) {\n return decodeAVMValue(type, bytes)\n }\n return type.decode(bytes)\n}\n\nexport function getABIEncodedValue(type: AVMType | ABIType, value: ABIValue): Uint8Array {\n return isAVMType(type) ? encodeAVMValue(type, value) : type.encode(value)\n}\n"],"mappings":";;;;AAMA,IAAY,oEAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEF,IAAY,gEAAL;AACL;AACA;AACA;;;AAuDF,IAAa,YAAb,MAAa,UAAU;CACrB,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CAET,YAAY,QAOT;AACD,OAAK,OAAO,OAAO;AACnB,OAAK,cAAc,OAAO;AAC1B,OAAK,OAAO,OAAO;AACnB,OAAK,UAAU,OAAO;AACtB,OAAK,SAAS,OAAO;AACrB,OAAK,WAAW,OAAO;;;;;;CAOzB,eAAuB;EACrB,MAAM,OAAO,KAAK,KACf,KAAK,QAAQ;AACZ,OAAI,qBAAqB,IAAI,KAAK,IAAI,mBAAmB,IAAI,KAAK,CAAE,QAAO,IAAI;AAC/E,UAAO,IAAI,KAAK;IAChB,CACD,KAAK,IAAI;AAEZ,SAAO,GAAG,KAAK,KAAK,GAAG,KAAK,GADZ,KAAK,QAAQ,SAAS,SAAS,SAAS,KAAK,QAAQ,KAAK;;;;;;CAQ5E,cAA0B;EACxB,MAAM,OAAO,OAAO,WAAW,MAAM,KAAK,cAAc,CAAC;AACzD,SAAO,IAAI,WAAW,KAAK,MAAM,GAAG,EAAE,CAAC;;;;;;;;CASzC,OAAO,cAAc,WAA8B;EACjD,MAAM,YAAY,UAAU,QAAQ,IAAI;AACxC,MAAI,cAAc,GAChB,OAAM,IAAI,MAAM,6BAA6B,YAAY;EAG3D,IAAI,UAAU;EACd,IAAI,QAAQ;AACZ,OAAK,IAAI,IAAI,WAAW,IAAI,UAAU,QAAQ,KAAK;GACjD,MAAM,OAAO,UAAU;AAEvB,OAAI,SAAS,IACX,UAAS;YACA,SAAS,KAAK;AACvB,QAAI,UAAU,EAEZ;AAGF,aAAS;AACT,QAAI,UAAU,GAAG;AACf,eAAU;AACV;;;;AAK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M,GAAG,KAAK,OAAO,MAAM"}
@@ -6,11 +6,11 @@ type ApplicationStateSchema = {
6
6
  /**
7
7
  * \[nui\] num of uints.
8
8
  */
9
- numUint: number;
9
+ numUints: number;
10
10
  /**
11
11
  * \[nbs\] num of byte slices.
12
12
  */
13
- numByteSlice: number;
13
+ numByteSlices: number;
14
14
  };
15
15
  //#endregion
16
16
  export { ApplicationStateSchema };
@@ -5,12 +5,12 @@ const ApplicationStateSchemaMeta = {
5
5
  name: "ApplicationStateSchema",
6
6
  kind: "object",
7
7
  fields: [{
8
- name: "numUint",
8
+ name: "numUints",
9
9
  wireKey: "num-uint",
10
10
  optional: false,
11
11
  codec: require_number.numberCodec
12
12
  }, {
13
- name: "numByteSlice",
13
+ name: "numByteSlices",
14
14
  wireKey: "num-byte-slice",
15
15
  optional: false,
16
16
  codec: require_number.numberCodec
@@ -1 +1 @@
1
- {"version":3,"file":"application-state-schema.js","names":["ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema>","numberCodec"],"sources":["../../../../../packages/algod_client/src/models/application-state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Specifies maximums on the number of each type that may be stored.\n */\nexport type ApplicationStateSchema = {\n /**\n * \\[nui\\] num of uints.\n */\n numUint: number\n\n /**\n * \\[nbs\\] num of byte slices.\n */\n numByteSlice: number\n}\n\nexport const ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema> = {\n name: 'ApplicationStateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUint',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlice',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,6BAA0E;CACrF,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOC;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOA;EACR,CACF;CACF"}
1
+ {"version":3,"file":"application-state-schema.js","names":["ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema>","numberCodec"],"sources":["../../../../../packages/algod_client/src/models/application-state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Specifies maximums on the number of each type that may be stored.\n */\nexport type ApplicationStateSchema = {\n /**\n * \\[nui\\] num of uints.\n */\n numUints: number\n\n /**\n * \\[nbs\\] num of byte slices.\n */\n numByteSlices: number\n}\n\nexport const ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema> = {\n name: 'ApplicationStateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUints',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlices',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,6BAA0E;CACrF,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOC;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOA;EACR,CACF;CACF"}
@@ -5,12 +5,12 @@ const ApplicationStateSchemaMeta = {
5
5
  name: "ApplicationStateSchema",
6
6
  kind: "object",
7
7
  fields: [{
8
- name: "numUint",
8
+ name: "numUints",
9
9
  wireKey: "num-uint",
10
10
  optional: false,
11
11
  codec: numberCodec
12
12
  }, {
13
- name: "numByteSlice",
13
+ name: "numByteSlices",
14
14
  wireKey: "num-byte-slice",
15
15
  optional: false,
16
16
  codec: numberCodec
@@ -1 +1 @@
1
- {"version":3,"file":"application-state-schema.mjs","names":["ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema>"],"sources":["../../../../../packages/algod_client/src/models/application-state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Specifies maximums on the number of each type that may be stored.\n */\nexport type ApplicationStateSchema = {\n /**\n * \\[nui\\] num of uints.\n */\n numUint: number\n\n /**\n * \\[nbs\\] num of byte slices.\n */\n numByteSlice: number\n}\n\nexport const ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema> = {\n name: 'ApplicationStateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUint',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlice',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,6BAA0E;CACrF,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,CACF;CACF"}
1
+ {"version":3,"file":"application-state-schema.mjs","names":["ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema>"],"sources":["../../../../../packages/algod_client/src/models/application-state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Specifies maximums on the number of each type that may be stored.\n */\nexport type ApplicationStateSchema = {\n /**\n * \\[nui\\] num of uints.\n */\n numUints: number\n\n /**\n * \\[nbs\\] num of byte slices.\n */\n numByteSlices: number\n}\n\nexport const ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema> = {\n name: 'ApplicationStateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUints',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlices',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,6BAA0E;CACrF,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,CACF;CACF"}
@@ -1,7 +1,7 @@
1
- import JSONbigWithoutConfig from "json-bigint";
1
+ import JSONbigFactory from "json-bigint";
2
2
 
3
3
  //#region packages/common/src/json.ts
4
- const JSONbig = JSONbigWithoutConfig({
4
+ const JSONbig = JSONbigFactory({
5
5
  useNativeBigInt: true,
6
6
  strict: true
7
7
  });
@@ -1 +1 @@
1
- {"version":3,"file":"json.mjs","names":["JSONbigFactory"],"sources":["../../../../packages/common/src/json.ts"],"sourcesContent":["import JSONbigFactory from 'json-bigint'\n\nconst JSONbig = JSONbigFactory({\n useNativeBigInt: true,\n strict: true,\n})\n\n/**\n * Parse JSON with bigint support.\n * @param str - The JSON string to parse.\n */\nexport function parseJson(str: string) {\n return JSONbig.parse(str, (_: string, value: unknown): unknown => {\n if (value != null && typeof value === 'object' && Object.getPrototypeOf(value) == null) {\n // JSONbig.parse objects are created with Object.create(null) and thus have a null prototype\n Object.setPrototypeOf(value, Object.prototype)\n }\n\n if (typeof value === 'bigint') {\n if (value > Number.MAX_SAFE_INTEGER) {\n return value\n }\n // JSONbig.parse converts number to BigInts if they are >= 10**15. This is smaller than\n // Number.MAX_SAFE_INTEGER, so we can convert some BigInts back to normal numbers.\n return Number(value)\n }\n\n return value\n })\n}\n\n/**\n * Convert a JavaScript value to a JSON string with bigint support.\n *\n * @param value - A JavaScript value, usually an object or array, to be converted.\n * @param replacer - A function that transforms the results.\n * @param space - Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n */\nexport function stringifyJson(\n value: unknown,\n replacer?: (this: unknown, key: string, value: unknown) => unknown,\n space?: string | number,\n): string {\n return JSONbig.stringify(value, replacer, space)\n}\n"],"mappings":";;;AAEA,MAAM,UAAUA,qBAAe;CAC7B,iBAAiB;CACjB,QAAQ;CACT,CAAC;;;;;AAMF,SAAgB,UAAU,KAAa;AACrC,QAAO,QAAQ,MAAM,MAAM,GAAW,UAA4B;AAChE,MAAI,SAAS,QAAQ,OAAO,UAAU,YAAY,OAAO,eAAe,MAAM,IAAI,KAEhF,QAAO,eAAe,OAAO,OAAO,UAAU;AAGhD,MAAI,OAAO,UAAU,UAAU;AAC7B,OAAI,QAAQ,OAAO,iBACjB,QAAO;AAIT,UAAO,OAAO,MAAM;;AAGtB,SAAO;GACP;;;;;;;;;AAUJ,SAAgB,cACd,OACA,UACA,OACQ;AACR,QAAO,QAAQ,UAAU,OAAO,UAAU,MAAM"}
1
+ {"version":3,"file":"json.mjs","names":[],"sources":["../../../../packages/common/src/json.ts"],"sourcesContent":["import JSONbigFactory from 'json-bigint'\n\nconst JSONbig = JSONbigFactory({\n useNativeBigInt: true,\n strict: true,\n})\n\n/**\n * Parse JSON with bigint support.\n * @param str - The JSON string to parse.\n */\nexport function parseJson(str: string) {\n return JSONbig.parse(str, (_: string, value: unknown): unknown => {\n if (value != null && typeof value === 'object' && Object.getPrototypeOf(value) == null) {\n // JSONbig.parse objects are created with Object.create(null) and thus have a null prototype\n Object.setPrototypeOf(value, Object.prototype)\n }\n\n if (typeof value === 'bigint') {\n if (value > Number.MAX_SAFE_INTEGER) {\n return value\n }\n // JSONbig.parse converts number to BigInts if they are >= 10**15. This is smaller than\n // Number.MAX_SAFE_INTEGER, so we can convert some BigInts back to normal numbers.\n return Number(value)\n }\n\n return value\n })\n}\n\n/**\n * Convert a JavaScript value to a JSON string with bigint support.\n *\n * @param value - A JavaScript value, usually an object or array, to be converted.\n * @param replacer - A function that transforms the results.\n * @param space - Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n */\nexport function stringifyJson(\n value: unknown,\n replacer?: (this: unknown, key: string, value: unknown) => unknown,\n space?: string | number,\n): string {\n return JSONbig.stringify(value, replacer, space)\n}\n"],"mappings":";;;AAEA,MAAM,UAAU,eAAe;CAC7B,iBAAiB;CACjB,QAAQ;CACT,CAAC;;;;;AAMF,SAAgB,UAAU,KAAa;AACrC,QAAO,QAAQ,MAAM,MAAM,GAAW,UAA4B;AAChE,MAAI,SAAS,QAAQ,OAAO,UAAU,YAAY,OAAO,eAAe,MAAM,IAAI,KAEhF,QAAO,eAAe,OAAO,OAAO,UAAU;AAGhD,MAAI,OAAO,UAAU,UAAU;AAC7B,OAAI,QAAQ,OAAO,iBACjB,QAAO;AAIT,UAAO,OAAO,MAAM;;AAGtB,SAAO;GACP;;;;;;;;;AAUJ,SAAgB,cACd,OACA,UACA,OACQ;AACR,QAAO,QAAQ,UAAU,OAAO,UAAU,MAAM"}
@@ -6,11 +6,11 @@ type ApplicationStateSchema = {
6
6
  /**
7
7
  * number of uints.
8
8
  */
9
- numUint: number;
9
+ numUints: number;
10
10
  /**
11
11
  * number of byte slices.
12
12
  */
13
- numByteSlice: number;
13
+ numByteSlices: number;
14
14
  };
15
15
  //#endregion
16
16
  export { ApplicationStateSchema };
@@ -5,12 +5,12 @@ const ApplicationStateSchemaMeta = {
5
5
  name: "ApplicationStateSchema",
6
6
  kind: "object",
7
7
  fields: [{
8
- name: "numUint",
8
+ name: "numUints",
9
9
  wireKey: "num-uint",
10
10
  optional: false,
11
11
  codec: require_number.numberCodec
12
12
  }, {
13
- name: "numByteSlice",
13
+ name: "numByteSlices",
14
14
  wireKey: "num-byte-slice",
15
15
  optional: false,
16
16
  codec: require_number.numberCodec
@@ -1 +1 @@
1
- {"version":3,"file":"application-state-schema.js","names":["ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema>","numberCodec"],"sources":["../../../../../packages/indexer_client/src/models/application-state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Specifies maximums on the number of each type that may be stored.\n */\nexport type ApplicationStateSchema = {\n /**\n * number of uints.\n */\n numUint: number\n\n /**\n * number of byte slices.\n */\n numByteSlice: number\n}\n\nexport const ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema> = {\n name: 'ApplicationStateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUint',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlice',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,6BAA0E;CACrF,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOC;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOA;EACR,CACF;CACF"}
1
+ {"version":3,"file":"application-state-schema.js","names":["ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema>","numberCodec"],"sources":["../../../../../packages/indexer_client/src/models/application-state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Specifies maximums on the number of each type that may be stored.\n */\nexport type ApplicationStateSchema = {\n /**\n * number of uints.\n */\n numUints: number\n\n /**\n * number of byte slices.\n */\n numByteSlices: number\n}\n\nexport const ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema> = {\n name: 'ApplicationStateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUints',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlices',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,6BAA0E;CACrF,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOC;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOA;EACR,CACF;CACF"}
@@ -5,12 +5,12 @@ const ApplicationStateSchemaMeta = {
5
5
  name: "ApplicationStateSchema",
6
6
  kind: "object",
7
7
  fields: [{
8
- name: "numUint",
8
+ name: "numUints",
9
9
  wireKey: "num-uint",
10
10
  optional: false,
11
11
  codec: numberCodec
12
12
  }, {
13
- name: "numByteSlice",
13
+ name: "numByteSlices",
14
14
  wireKey: "num-byte-slice",
15
15
  optional: false,
16
16
  codec: numberCodec
@@ -1 +1 @@
1
- {"version":3,"file":"application-state-schema.mjs","names":["ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema>"],"sources":["../../../../../packages/indexer_client/src/models/application-state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Specifies maximums on the number of each type that may be stored.\n */\nexport type ApplicationStateSchema = {\n /**\n * number of uints.\n */\n numUint: number\n\n /**\n * number of byte slices.\n */\n numByteSlice: number\n}\n\nexport const ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema> = {\n name: 'ApplicationStateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUint',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlice',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,6BAA0E;CACrF,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,CACF;CACF"}
1
+ {"version":3,"file":"application-state-schema.mjs","names":["ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema>"],"sources":["../../../../../packages/indexer_client/src/models/application-state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Specifies maximums on the number of each type that may be stored.\n */\nexport type ApplicationStateSchema = {\n /**\n * number of uints.\n */\n numUints: number\n\n /**\n * number of byte slices.\n */\n numByteSlices: number\n}\n\nexport const ApplicationStateSchemaMeta: ObjectModelMetadata<ApplicationStateSchema> = {\n name: 'ApplicationStateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUints',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlices',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,6BAA0E;CACrF,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,CACF;CACF"}
@@ -6,11 +6,11 @@ type StateSchema = {
6
6
  /**
7
7
  * Maximum number of TEAL uints that may be stored in the key/value store.
8
8
  */
9
- numUint: number;
9
+ numUints: number;
10
10
  /**
11
11
  * Maximum number of TEAL byte slices that may be stored in the key/value store.
12
12
  */
13
- numByteSlice: number;
13
+ numByteSlices: number;
14
14
  };
15
15
  //#endregion
16
16
  export { StateSchema };
@@ -5,12 +5,12 @@ const StateSchemaMeta = {
5
5
  name: "StateSchema",
6
6
  kind: "object",
7
7
  fields: [{
8
- name: "numUint",
8
+ name: "numUints",
9
9
  wireKey: "num-uint",
10
10
  optional: false,
11
11
  codec: require_number.numberCodec
12
12
  }, {
13
- name: "numByteSlice",
13
+ name: "numByteSlices",
14
14
  wireKey: "num-byte-slice",
15
15
  optional: false,
16
16
  codec: require_number.numberCodec
@@ -1 +1 @@
1
- {"version":3,"file":"state-schema.js","names":["StateSchemaMeta: ObjectModelMetadata<StateSchema>","numberCodec"],"sources":["../../../../../packages/indexer_client/src/models/state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Represents a \\[apls\\] local-state or \\[apgs\\] global-state schema. These schemas determine how much storage may be used in a local-state or global-state for an application. The more space used, the larger minimum balance must be maintained in the account holding the data.\n */\nexport type StateSchema = {\n /**\n * Maximum number of TEAL uints that may be stored in the key/value store.\n */\n numUint: number\n\n /**\n * Maximum number of TEAL byte slices that may be stored in the key/value store.\n */\n numByteSlice: number\n}\n\nexport const StateSchemaMeta: ObjectModelMetadata<StateSchema> = {\n name: 'StateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUint',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlice',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,kBAAoD;CAC/D,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOC;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOA;EACR,CACF;CACF"}
1
+ {"version":3,"file":"state-schema.js","names":["StateSchemaMeta: ObjectModelMetadata<StateSchema>","numberCodec"],"sources":["../../../../../packages/indexer_client/src/models/state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Represents a \\[apls\\] local-state or \\[apgs\\] global-state schema. These schemas determine how much storage may be used in a local-state or global-state for an application. The more space used, the larger minimum balance must be maintained in the account holding the data.\n */\nexport type StateSchema = {\n /**\n * Maximum number of TEAL uints that may be stored in the key/value store.\n */\n numUints: number\n\n /**\n * Maximum number of TEAL byte slices that may be stored in the key/value store.\n */\n numByteSlices: number\n}\n\nexport const StateSchemaMeta: ObjectModelMetadata<StateSchema> = {\n name: 'StateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUints',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlices',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,kBAAoD;CAC/D,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOC;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAOA;EACR,CACF;CACF"}
@@ -5,12 +5,12 @@ const StateSchemaMeta = {
5
5
  name: "StateSchema",
6
6
  kind: "object",
7
7
  fields: [{
8
- name: "numUint",
8
+ name: "numUints",
9
9
  wireKey: "num-uint",
10
10
  optional: false,
11
11
  codec: numberCodec
12
12
  }, {
13
- name: "numByteSlice",
13
+ name: "numByteSlices",
14
14
  wireKey: "num-byte-slice",
15
15
  optional: false,
16
16
  codec: numberCodec
@@ -1 +1 @@
1
- {"version":3,"file":"state-schema.mjs","names":["StateSchemaMeta: ObjectModelMetadata<StateSchema>"],"sources":["../../../../../packages/indexer_client/src/models/state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Represents a \\[apls\\] local-state or \\[apgs\\] global-state schema. These schemas determine how much storage may be used in a local-state or global-state for an application. The more space used, the larger minimum balance must be maintained in the account holding the data.\n */\nexport type StateSchema = {\n /**\n * Maximum number of TEAL uints that may be stored in the key/value store.\n */\n numUint: number\n\n /**\n * Maximum number of TEAL byte slices that may be stored in the key/value store.\n */\n numByteSlice: number\n}\n\nexport const StateSchemaMeta: ObjectModelMetadata<StateSchema> = {\n name: 'StateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUint',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlice',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,kBAAoD;CAC/D,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,CACF;CACF"}
1
+ {"version":3,"file":"state-schema.mjs","names":["StateSchemaMeta: ObjectModelMetadata<StateSchema>"],"sources":["../../../../../packages/indexer_client/src/models/state-schema.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * Represents a \\[apls\\] local-state or \\[apgs\\] global-state schema. These schemas determine how much storage may be used in a local-state or global-state for an application. The more space used, the larger minimum balance must be maintained in the account holding the data.\n */\nexport type StateSchema = {\n /**\n * Maximum number of TEAL uints that may be stored in the key/value store.\n */\n numUints: number\n\n /**\n * Maximum number of TEAL byte slices that may be stored in the key/value store.\n */\n numByteSlices: number\n}\n\nexport const StateSchemaMeta: ObjectModelMetadata<StateSchema> = {\n name: 'StateSchema',\n kind: 'object',\n fields: [\n {\n name: 'numUints',\n wireKey: 'num-uint',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'numByteSlices',\n wireKey: 'num-byte-slice',\n optional: false,\n codec: numberCodec,\n },\n ],\n}\n"],"mappings":";;;AAkBA,MAAaA,kBAAoD;CAC/D,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,EACD;EACE,MAAM;EACN,SAAS;EACT,UAAU;EACV,OAAO;EACR,CACF;CACF"}
@@ -58,7 +58,7 @@ type Transaction = {
58
58
  /**
59
59
  * \[fv\] First valid round for this transaction.
60
60
  */
61
- firstValid: number;
61
+ firstValid: bigint;
62
62
  /**
63
63
  * \[gh\] Hash of genesis block.
64
64
  */
@@ -83,7 +83,7 @@ type Transaction = {
83
83
  /**
84
84
  * \[lv\] Last valid round for this transaction.
85
85
  */
86
- lastValid: number;
86
+ lastValid: bigint;
87
87
  /**
88
88
  * \[lx\] Base64 encoded 32-byte array. Lease enforces mutual exclusion of transactions. If this field is nonzero, then once the transaction is confirmed, it acquires the lease identified by the (Sender, Lease) pair of the transaction until the LastValid round passes. While this transaction possesses the lease, no other transaction specifying this lease can be confirmed.
89
89
  */
@@ -105,7 +105,7 @@ const TransactionMeta = {
105
105
  name: "firstValid",
106
106
  wireKey: "first-valid",
107
107
  optional: false,
108
- codec: require_number.numberCodec
108
+ codec: require_bigint.bigIntCodec
109
109
  },
110
110
  {
111
111
  name: "genesisHash",
@@ -147,7 +147,7 @@ const TransactionMeta = {
147
147
  name: "lastValid",
148
148
  wireKey: "last-valid",
149
149
  optional: false,
150
- codec: require_number.numberCodec
150
+ codec: require_bigint.bigIntCodec
151
151
  },
152
152
  {
153
153
  name: "lease",
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","names":["TransactionMeta: ObjectModelMetadata<Transaction>","ObjectModelCodec","TransactionApplicationMeta","TransactionAssetConfigMeta","TransactionAssetFreezeMeta","TransactionAssetTransferMeta","TransactionStateProofMeta","TransactionHeartbeatMeta","addressCodec","bigIntCodec","numberCodec","bytesCodec","stringCodec","TransactionKeyregMeta","TransactionPaymentMeta","TransactionSignatureMeta","ArrayCodec","AccountStateDeltaMeta","ArrayModelCodec","StateDeltaMeta","bytesArrayCodec"],"sources":["../../../../../packages/indexer_client/src/models/transaction.ts"],"sourcesContent":["import type { Address, ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport {\n stringCodec,\n numberCodec,\n bigIntCodec,\n bytesCodec,\n addressCodec,\n ArrayCodec,\n bytesArrayCodec,\n ObjectModelCodec,\n ArrayModelCodec,\n} from '@algorandfoundation/algokit-common'\nimport type { AccountStateDelta } from './account-state-delta'\nimport { AccountStateDeltaMeta } from './account-state-delta'\nimport type { StateDelta } from './state-delta'\nimport { StateDeltaMeta } from './state-delta'\nimport type { TransactionApplication } from './transaction-application'\nimport { TransactionApplicationMeta } from './transaction-application'\nimport type { TransactionAssetConfig } from './transaction-asset-config'\nimport { TransactionAssetConfigMeta } from './transaction-asset-config'\nimport type { TransactionAssetFreeze } from './transaction-asset-freeze'\nimport { TransactionAssetFreezeMeta } from './transaction-asset-freeze'\nimport type { TransactionAssetTransfer } from './transaction-asset-transfer'\nimport { TransactionAssetTransferMeta } from './transaction-asset-transfer'\nimport type { TransactionHeartbeat } from './transaction-heartbeat'\nimport { TransactionHeartbeatMeta } from './transaction-heartbeat'\nimport type { TransactionKeyreg } from './transaction-keyreg'\nimport { TransactionKeyregMeta } from './transaction-keyreg'\nimport type { TransactionPayment } from './transaction-payment'\nimport { TransactionPaymentMeta } from './transaction-payment'\nimport type { TransactionSignature } from './transaction-signature'\nimport { TransactionSignatureMeta } from './transaction-signature'\nimport type { TransactionStateProof } from './transaction-state-proof'\nimport { TransactionStateProofMeta } from './transaction-state-proof'\n\n/**\n * Contains all fields common to all transactions and serves as an envelope to all transactions type. Represents both regular and inner transactions.\n *\n * Definition:\n * data/transactions/signedtxn.go : SignedTxn\n * data/transactions/transaction.go : Transaction\n */\nexport type Transaction = {\n applicationTransaction?: TransactionApplication\n assetConfigTransaction?: TransactionAssetConfig\n assetFreezeTransaction?: TransactionAssetFreeze\n assetTransferTransaction?: TransactionAssetTransfer\n stateProofTransaction?: TransactionStateProof\n heartbeatTransaction?: TransactionHeartbeat\n\n /**\n * \\[sgnr\\] this is included with signed transactions when the signing address does not equal the sender. The backend can use this to ensure that auth addr is equal to the accounts auth addr.\n */\n authAddr?: Address\n\n /**\n * \\[rc\\] rewards applied to close-remainder-to account.\n */\n closeRewards?: bigint\n\n /**\n * \\[ca\\] closing amount for transaction.\n */\n closingAmount?: bigint\n\n /**\n * Round when the transaction was confirmed.\n */\n confirmedRound?: bigint\n\n /**\n * Specifies an application index (ID) if an application was created with this transaction.\n */\n createdAppId?: bigint\n\n /**\n * Specifies an asset index (ID) if an asset was created with this transaction.\n */\n createdAssetId?: bigint\n\n /**\n * \\[fee\\] Transaction fee.\n */\n fee: bigint\n\n /**\n * \\[fv\\] First valid round for this transaction.\n */\n firstValid: number\n\n /**\n * \\[gh\\] Hash of genesis block.\n */\n genesisHash?: Uint8Array\n\n /**\n * \\[gen\\] genesis block ID.\n */\n genesisId?: string\n\n /**\n * \\[grp\\] Base64 encoded byte array of a sha512/256 digest. When present indicates that this transaction is part of a transaction group and the value is the sha512/256 hash of the transactions in that group.\n */\n group?: Uint8Array\n\n /**\n * Transaction ID\n */\n id?: string\n\n /**\n * Offset into the round where this transaction was confirmed.\n */\n intraRoundOffset?: number\n keyregTransaction?: TransactionKeyreg\n\n /**\n * \\[lv\\] Last valid round for this transaction.\n */\n lastValid: number\n\n /**\n * \\[lx\\] Base64 encoded 32-byte array. Lease enforces mutual exclusion of transactions. If this field is nonzero, then once the transaction is confirmed, it acquires the lease identified by the (Sender, Lease) pair of the transaction until the LastValid round passes. While this transaction possesses the lease, no other transaction specifying this lease can be confirmed.\n */\n lease?: Uint8Array\n\n /**\n * \\[note\\] Free form data.\n */\n note?: Uint8Array\n paymentTransaction?: TransactionPayment\n\n /**\n * \\[rr\\] rewards applied to receiver account.\n */\n receiverRewards?: bigint\n\n /**\n * \\[rekey\\] when included in a valid transaction, the accounts auth addr will be updated with this value and future signatures must be signed with the key represented by this address.\n */\n rekeyTo?: Address\n\n /**\n * Time when the block this transaction is in was confirmed.\n */\n roundTime?: number\n\n /**\n * \\[snd\\] Sender's address.\n */\n sender: string\n\n /**\n * \\[rs\\] rewards applied to sender account.\n */\n senderRewards?: bigint\n signature?: TransactionSignature\n\n /**\n * \\[type\\] Indicates what type of transaction this is. Different types have different fields.\n *\n * Valid types, and where their fields are stored:\n * * \\[pay\\] payment-transaction\n * * \\[keyreg\\] keyreg-transaction\n * * \\[acfg\\] asset-config-transaction\n * * \\[axfer\\] asset-transfer-transaction\n * * \\[afrz\\] asset-freeze-transaction\n * * \\[appl\\] application-transaction\n * * \\[stpf\\] state-proof-transaction\n * * \\[hb\\] heartbeat-transaction\n */\n txType: 'pay' | 'keyreg' | 'acfg' | 'axfer' | 'afrz' | 'appl' | 'stpf' | 'hb'\n\n /**\n * \\[ld\\] Local state key/value changes for the application being executed by this transaction.\n */\n localStateDelta?: AccountStateDelta[]\n globalStateDelta?: StateDelta\n\n /**\n * \\[lg\\] Logs for the application being executed by this transaction.\n */\n logs?: Uint8Array[]\n\n /**\n * Inner transactions produced by application execution.\n */\n innerTxns?: Transaction[]\n}\n\nexport const TransactionMeta: ObjectModelMetadata<Transaction> = {\n name: 'Transaction',\n kind: 'object',\n fields: [\n {\n name: 'applicationTransaction',\n wireKey: 'application-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionApplicationMeta),\n },\n {\n name: 'assetConfigTransaction',\n wireKey: 'asset-config-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionAssetConfigMeta),\n },\n {\n name: 'assetFreezeTransaction',\n wireKey: 'asset-freeze-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionAssetFreezeMeta),\n },\n {\n name: 'assetTransferTransaction',\n wireKey: 'asset-transfer-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionAssetTransferMeta),\n },\n {\n name: 'stateProofTransaction',\n wireKey: 'state-proof-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionStateProofMeta),\n },\n {\n name: 'heartbeatTransaction',\n wireKey: 'heartbeat-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionHeartbeatMeta),\n },\n {\n name: 'authAddr',\n wireKey: 'auth-addr',\n optional: true,\n codec: addressCodec,\n },\n {\n name: 'closeRewards',\n wireKey: 'close-rewards',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'closingAmount',\n wireKey: 'closing-amount',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'confirmedRound',\n wireKey: 'confirmed-round',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'createdAppId',\n wireKey: 'created-application-index',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'createdAssetId',\n wireKey: 'created-asset-index',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'fee',\n wireKey: 'fee',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'firstValid',\n wireKey: 'first-valid',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'genesisHash',\n wireKey: 'genesis-hash',\n optional: true,\n codec: bytesCodec,\n },\n {\n name: 'genesisId',\n wireKey: 'genesis-id',\n optional: true,\n codec: stringCodec,\n },\n {\n name: 'group',\n wireKey: 'group',\n optional: true,\n codec: bytesCodec,\n },\n {\n name: 'id',\n wireKey: 'id',\n optional: true,\n codec: stringCodec,\n },\n {\n name: 'intraRoundOffset',\n wireKey: 'intra-round-offset',\n optional: true,\n codec: numberCodec,\n },\n {\n name: 'keyregTransaction',\n wireKey: 'keyreg-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionKeyregMeta),\n },\n {\n name: 'lastValid',\n wireKey: 'last-valid',\n optional: false,\n codec: numberCodec,\n },\n {\n name: 'lease',\n wireKey: 'lease',\n optional: true,\n codec: bytesCodec,\n },\n {\n name: 'note',\n wireKey: 'note',\n optional: true,\n codec: bytesCodec,\n },\n {\n name: 'paymentTransaction',\n wireKey: 'payment-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionPaymentMeta),\n },\n {\n name: 'receiverRewards',\n wireKey: 'receiver-rewards',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'rekeyTo',\n wireKey: 'rekey-to',\n optional: true,\n codec: addressCodec,\n },\n {\n name: 'roundTime',\n wireKey: 'round-time',\n optional: true,\n codec: numberCodec,\n },\n {\n name: 'sender',\n wireKey: 'sender',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'senderRewards',\n wireKey: 'sender-rewards',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'signature',\n wireKey: 'signature',\n optional: true,\n codec: new ObjectModelCodec(TransactionSignatureMeta),\n },\n {\n name: 'txType',\n wireKey: 'tx-type',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'localStateDelta',\n wireKey: 'local-state-delta',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(AccountStateDeltaMeta)),\n },\n {\n name: 'globalStateDelta',\n wireKey: 'global-state-delta',\n optional: true,\n codec: new ArrayModelCodec(StateDeltaMeta),\n },\n {\n name: 'logs',\n wireKey: 'logs',\n optional: true,\n codec: bytesArrayCodec,\n },\n {\n name: 'innerTxns',\n wireKey: 'inner-txns',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(() => TransactionMeta)),\n },\n ],\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8LA,MAAaA,kBAAoD;CAC/D,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIC,sCAAiBC,2DAA2B;GACxD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAID,sCAAiBE,4DAA2B;GACxD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIF,sCAAiBG,4DAA2B;GACxD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIH,sCAAiBI,gEAA6B;GAC1D;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIJ,sCAAiBK,0DAA0B;GACvD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIL,sCAAiBM,uDAAyB;GACtD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOD;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOF;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIT,sCAAiBY,iDAAsB;GACnD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOH;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIV,sCAAiBa,mDAAuB;GACpD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOL;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOD;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOE;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOE;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOH;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIR,sCAAiBc,uDAAyB;GACtD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOH;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAII,yBAAW,IAAIf,sCAAiBgB,kDAAsB,CAAC;GACnE;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIC,oCAAgBC,mCAAe;GAC3C;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIJ,yBAAW,IAAIf,4CAAuB,gBAAgB,CAAC;GACnE;EACF;CACF"}
1
+ {"version":3,"file":"transaction.js","names":["TransactionMeta: ObjectModelMetadata<Transaction>","ObjectModelCodec","TransactionApplicationMeta","TransactionAssetConfigMeta","TransactionAssetFreezeMeta","TransactionAssetTransferMeta","TransactionStateProofMeta","TransactionHeartbeatMeta","addressCodec","bigIntCodec","bytesCodec","stringCodec","numberCodec","TransactionKeyregMeta","TransactionPaymentMeta","TransactionSignatureMeta","ArrayCodec","AccountStateDeltaMeta","ArrayModelCodec","StateDeltaMeta","bytesArrayCodec"],"sources":["../../../../../packages/indexer_client/src/models/transaction.ts"],"sourcesContent":["import type { Address, ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport {\n stringCodec,\n numberCodec,\n bigIntCodec,\n bytesCodec,\n addressCodec,\n ArrayCodec,\n bytesArrayCodec,\n ObjectModelCodec,\n ArrayModelCodec,\n} from '@algorandfoundation/algokit-common'\nimport type { AccountStateDelta } from './account-state-delta'\nimport { AccountStateDeltaMeta } from './account-state-delta'\nimport type { StateDelta } from './state-delta'\nimport { StateDeltaMeta } from './state-delta'\nimport type { TransactionApplication } from './transaction-application'\nimport { TransactionApplicationMeta } from './transaction-application'\nimport type { TransactionAssetConfig } from './transaction-asset-config'\nimport { TransactionAssetConfigMeta } from './transaction-asset-config'\nimport type { TransactionAssetFreeze } from './transaction-asset-freeze'\nimport { TransactionAssetFreezeMeta } from './transaction-asset-freeze'\nimport type { TransactionAssetTransfer } from './transaction-asset-transfer'\nimport { TransactionAssetTransferMeta } from './transaction-asset-transfer'\nimport type { TransactionHeartbeat } from './transaction-heartbeat'\nimport { TransactionHeartbeatMeta } from './transaction-heartbeat'\nimport type { TransactionKeyreg } from './transaction-keyreg'\nimport { TransactionKeyregMeta } from './transaction-keyreg'\nimport type { TransactionPayment } from './transaction-payment'\nimport { TransactionPaymentMeta } from './transaction-payment'\nimport type { TransactionSignature } from './transaction-signature'\nimport { TransactionSignatureMeta } from './transaction-signature'\nimport type { TransactionStateProof } from './transaction-state-proof'\nimport { TransactionStateProofMeta } from './transaction-state-proof'\n\n/**\n * Contains all fields common to all transactions and serves as an envelope to all transactions type. Represents both regular and inner transactions.\n *\n * Definition:\n * data/transactions/signedtxn.go : SignedTxn\n * data/transactions/transaction.go : Transaction\n */\nexport type Transaction = {\n applicationTransaction?: TransactionApplication\n assetConfigTransaction?: TransactionAssetConfig\n assetFreezeTransaction?: TransactionAssetFreeze\n assetTransferTransaction?: TransactionAssetTransfer\n stateProofTransaction?: TransactionStateProof\n heartbeatTransaction?: TransactionHeartbeat\n\n /**\n * \\[sgnr\\] this is included with signed transactions when the signing address does not equal the sender. The backend can use this to ensure that auth addr is equal to the accounts auth addr.\n */\n authAddr?: Address\n\n /**\n * \\[rc\\] rewards applied to close-remainder-to account.\n */\n closeRewards?: bigint\n\n /**\n * \\[ca\\] closing amount for transaction.\n */\n closingAmount?: bigint\n\n /**\n * Round when the transaction was confirmed.\n */\n confirmedRound?: bigint\n\n /**\n * Specifies an application index (ID) if an application was created with this transaction.\n */\n createdAppId?: bigint\n\n /**\n * Specifies an asset index (ID) if an asset was created with this transaction.\n */\n createdAssetId?: bigint\n\n /**\n * \\[fee\\] Transaction fee.\n */\n fee: bigint\n\n /**\n * \\[fv\\] First valid round for this transaction.\n */\n firstValid: bigint\n\n /**\n * \\[gh\\] Hash of genesis block.\n */\n genesisHash?: Uint8Array\n\n /**\n * \\[gen\\] genesis block ID.\n */\n genesisId?: string\n\n /**\n * \\[grp\\] Base64 encoded byte array of a sha512/256 digest. When present indicates that this transaction is part of a transaction group and the value is the sha512/256 hash of the transactions in that group.\n */\n group?: Uint8Array\n\n /**\n * Transaction ID\n */\n id?: string\n\n /**\n * Offset into the round where this transaction was confirmed.\n */\n intraRoundOffset?: number\n keyregTransaction?: TransactionKeyreg\n\n /**\n * \\[lv\\] Last valid round for this transaction.\n */\n lastValid: bigint\n\n /**\n * \\[lx\\] Base64 encoded 32-byte array. Lease enforces mutual exclusion of transactions. If this field is nonzero, then once the transaction is confirmed, it acquires the lease identified by the (Sender, Lease) pair of the transaction until the LastValid round passes. While this transaction possesses the lease, no other transaction specifying this lease can be confirmed.\n */\n lease?: Uint8Array\n\n /**\n * \\[note\\] Free form data.\n */\n note?: Uint8Array\n paymentTransaction?: TransactionPayment\n\n /**\n * \\[rr\\] rewards applied to receiver account.\n */\n receiverRewards?: bigint\n\n /**\n * \\[rekey\\] when included in a valid transaction, the accounts auth addr will be updated with this value and future signatures must be signed with the key represented by this address.\n */\n rekeyTo?: Address\n\n /**\n * Time when the block this transaction is in was confirmed.\n */\n roundTime?: number\n\n /**\n * \\[snd\\] Sender's address.\n */\n sender: string\n\n /**\n * \\[rs\\] rewards applied to sender account.\n */\n senderRewards?: bigint\n signature?: TransactionSignature\n\n /**\n * \\[type\\] Indicates what type of transaction this is. Different types have different fields.\n *\n * Valid types, and where their fields are stored:\n * * \\[pay\\] payment-transaction\n * * \\[keyreg\\] keyreg-transaction\n * * \\[acfg\\] asset-config-transaction\n * * \\[axfer\\] asset-transfer-transaction\n * * \\[afrz\\] asset-freeze-transaction\n * * \\[appl\\] application-transaction\n * * \\[stpf\\] state-proof-transaction\n * * \\[hb\\] heartbeat-transaction\n */\n txType: 'pay' | 'keyreg' | 'acfg' | 'axfer' | 'afrz' | 'appl' | 'stpf' | 'hb'\n\n /**\n * \\[ld\\] Local state key/value changes for the application being executed by this transaction.\n */\n localStateDelta?: AccountStateDelta[]\n globalStateDelta?: StateDelta\n\n /**\n * \\[lg\\] Logs for the application being executed by this transaction.\n */\n logs?: Uint8Array[]\n\n /**\n * Inner transactions produced by application execution.\n */\n innerTxns?: Transaction[]\n}\n\nexport const TransactionMeta: ObjectModelMetadata<Transaction> = {\n name: 'Transaction',\n kind: 'object',\n fields: [\n {\n name: 'applicationTransaction',\n wireKey: 'application-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionApplicationMeta),\n },\n {\n name: 'assetConfigTransaction',\n wireKey: 'asset-config-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionAssetConfigMeta),\n },\n {\n name: 'assetFreezeTransaction',\n wireKey: 'asset-freeze-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionAssetFreezeMeta),\n },\n {\n name: 'assetTransferTransaction',\n wireKey: 'asset-transfer-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionAssetTransferMeta),\n },\n {\n name: 'stateProofTransaction',\n wireKey: 'state-proof-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionStateProofMeta),\n },\n {\n name: 'heartbeatTransaction',\n wireKey: 'heartbeat-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionHeartbeatMeta),\n },\n {\n name: 'authAddr',\n wireKey: 'auth-addr',\n optional: true,\n codec: addressCodec,\n },\n {\n name: 'closeRewards',\n wireKey: 'close-rewards',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'closingAmount',\n wireKey: 'closing-amount',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'confirmedRound',\n wireKey: 'confirmed-round',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'createdAppId',\n wireKey: 'created-application-index',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'createdAssetId',\n wireKey: 'created-asset-index',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'fee',\n wireKey: 'fee',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'firstValid',\n wireKey: 'first-valid',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'genesisHash',\n wireKey: 'genesis-hash',\n optional: true,\n codec: bytesCodec,\n },\n {\n name: 'genesisId',\n wireKey: 'genesis-id',\n optional: true,\n codec: stringCodec,\n },\n {\n name: 'group',\n wireKey: 'group',\n optional: true,\n codec: bytesCodec,\n },\n {\n name: 'id',\n wireKey: 'id',\n optional: true,\n codec: stringCodec,\n },\n {\n name: 'intraRoundOffset',\n wireKey: 'intra-round-offset',\n optional: true,\n codec: numberCodec,\n },\n {\n name: 'keyregTransaction',\n wireKey: 'keyreg-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionKeyregMeta),\n },\n {\n name: 'lastValid',\n wireKey: 'last-valid',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'lease',\n wireKey: 'lease',\n optional: true,\n codec: bytesCodec,\n },\n {\n name: 'note',\n wireKey: 'note',\n optional: true,\n codec: bytesCodec,\n },\n {\n name: 'paymentTransaction',\n wireKey: 'payment-transaction',\n optional: true,\n codec: new ObjectModelCodec(TransactionPaymentMeta),\n },\n {\n name: 'receiverRewards',\n wireKey: 'receiver-rewards',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'rekeyTo',\n wireKey: 'rekey-to',\n optional: true,\n codec: addressCodec,\n },\n {\n name: 'roundTime',\n wireKey: 'round-time',\n optional: true,\n codec: numberCodec,\n },\n {\n name: 'sender',\n wireKey: 'sender',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'senderRewards',\n wireKey: 'sender-rewards',\n optional: true,\n codec: bigIntCodec,\n },\n {\n name: 'signature',\n wireKey: 'signature',\n optional: true,\n codec: new ObjectModelCodec(TransactionSignatureMeta),\n },\n {\n name: 'txType',\n wireKey: 'tx-type',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'localStateDelta',\n wireKey: 'local-state-delta',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(AccountStateDeltaMeta)),\n },\n {\n name: 'globalStateDelta',\n wireKey: 'global-state-delta',\n optional: true,\n codec: new ArrayModelCodec(StateDeltaMeta),\n },\n {\n name: 'logs',\n wireKey: 'logs',\n optional: true,\n codec: bytesArrayCodec,\n },\n {\n name: 'innerTxns',\n wireKey: 'inner-txns',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(() => TransactionMeta)),\n },\n ],\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8LA,MAAaA,kBAAoD;CAC/D,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIC,sCAAiBC,2DAA2B;GACxD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAID,sCAAiBE,4DAA2B;GACxD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIF,sCAAiBG,4DAA2B;GACxD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIH,sCAAiBI,gEAA6B;GAC1D;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIJ,sCAAiBK,0DAA0B;GACvD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIL,sCAAiBM,uDAAyB;GACtD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOD;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIX,sCAAiBY,iDAAsB;GACnD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOJ;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIT,sCAAiBa,mDAAuB;GACpD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOL;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOD;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOI;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOD;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOF;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIR,sCAAiBc,uDAAyB;GACtD;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOJ;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIK,yBAAW,IAAIf,sCAAiBgB,kDAAsB,CAAC;GACnE;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIC,oCAAgBC,mCAAe;GAC3C;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAIJ,yBAAW,IAAIf,4CAAuB,gBAAgB,CAAC;GACnE;EACF;CACF"}
@@ -105,7 +105,7 @@ const TransactionMeta = {
105
105
  name: "firstValid",
106
106
  wireKey: "first-valid",
107
107
  optional: false,
108
- codec: numberCodec
108
+ codec: bigIntCodec
109
109
  },
110
110
  {
111
111
  name: "genesisHash",
@@ -147,7 +147,7 @@ const TransactionMeta = {
147
147
  name: "lastValid",
148
148
  wireKey: "last-valid",
149
149
  optional: false,
150
- codec: numberCodec
150
+ codec: bigIntCodec
151
151
  },
152
152
  {
153
153
  name: "lease",