@algorandfoundation/algokit-utils 10.0.0-alpha.4 → 10.0.0-alpha.6
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.
- package/algod-client/index.d.ts +1 -4
- package/package.json +1 -1
- package/packages/algod_client/src/models/application-state-schema.d.ts +2 -2
- package/packages/algod_client/src/models/application-state-schema.js +2 -2
- package/packages/algod_client/src/models/application-state-schema.js.map +1 -1
- package/packages/algod_client/src/models/application-state-schema.mjs +2 -2
- package/packages/algod_client/src/models/application-state-schema.mjs.map +1 -1
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.d.ts +3 -5
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.js +4 -6
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.js.map +1 -1
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.mjs +3 -5
- package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.mjs.map +1 -1
- package/packages/indexer_client/src/models/application-state-schema.d.ts +2 -2
- package/packages/indexer_client/src/models/application-state-schema.js +2 -2
- package/packages/indexer_client/src/models/application-state-schema.js.map +1 -1
- package/packages/indexer_client/src/models/application-state-schema.mjs +2 -2
- package/packages/indexer_client/src/models/application-state-schema.mjs.map +1 -1
- package/packages/indexer_client/src/models/state-schema.d.ts +2 -2
- package/packages/indexer_client/src/models/state-schema.js +2 -2
- package/packages/indexer_client/src/models/state-schema.js.map +1 -1
- package/packages/indexer_client/src/models/state-schema.mjs +2 -2
- package/packages/indexer_client/src/models/state-schema.mjs.map +1 -1
- package/packages/indexer_client/src/models/transaction.d.ts +2 -2
- package/packages/indexer_client/src/models/transaction.js +2 -2
- package/packages/indexer_client/src/models/transaction.js.map +1 -1
- package/packages/indexer_client/src/models/transaction.mjs +2 -2
- package/packages/indexer_client/src/models/transaction.mjs.map +1 -1
- package/packages/transact/src/multisig.d.ts +2 -2
- package/packages/transact/src/multisig.js +15 -15
- package/packages/transact/src/multisig.js.map +1 -1
- package/packages/transact/src/multisig.mjs +15 -15
- package/packages/transact/src/multisig.mjs.map +1 -1
- package/packages/transact/src/transactions/app-call.d.ts +8 -8
- package/packages/transact/src/transactions/app-call.js.map +1 -1
- package/packages/transact/src/transactions/app-call.mjs.map +1 -1
- package/packages/transact/src/transactions/reference-types-meta.d.ts +26 -0
- package/packages/transact/src/transactions/reference-types-meta.js +71 -0
- package/packages/transact/src/transactions/reference-types-meta.js.map +1 -0
- package/packages/transact/src/transactions/reference-types-meta.mjs +69 -0
- package/packages/transact/src/transactions/reference-types-meta.mjs.map +1 -0
- package/packages/transact/src/transactions/transaction-meta.js +22 -22
- package/packages/transact/src/transactions/transaction-meta.js.map +1 -1
- package/packages/transact/src/transactions/transaction-meta.mjs +22 -22
- package/packages/transact/src/transactions/transaction-meta.mjs.map +1 -1
- package/transact/index.d.ts +3 -2
- package/transact/index.js +4 -0
- package/transact/index.mjs +2 -1
- package/transactions/app-call.d.ts +2 -2
- package/transactions/app-call.js +15 -15
- package/transactions/app-call.js.map +1 -1
- package/transactions/app-call.mjs +15 -15
- package/transactions/app-call.mjs.map +1 -1
- package/transactions/asset-config.d.ts +1 -1
- package/transactions/asset-config.js +1 -1
- package/transactions/asset-config.js.map +1 -1
- package/transactions/asset-config.mjs +1 -1
- package/transactions/asset-config.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +72 -72
- package/types/algorand-client-transaction-sender.d.ts +75 -75
- package/types/app-client.d.ts +115 -115
- package/types/app-factory.d.ts +64 -64
- package/types/app-manager.js +5 -5
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +5 -5
- package/types/app-manager.mjs.map +1 -1
- package/types/composer.js +3 -3
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +3 -3
- package/types/composer.mjs.map +1 -1
- package/packages/algod_client/src/models/application-local-reference.d.ts +0 -20
- package/packages/algod_client/src/models/application-local-reference.js +0 -23
- package/packages/algod_client/src/models/application-local-reference.js.map +0 -1
- package/packages/algod_client/src/models/application-local-reference.mjs +0 -23
- package/packages/algod_client/src/models/application-local-reference.mjs.map +0 -1
- package/packages/algod_client/src/models/asset-holding-reference.d.ts +0 -20
- package/packages/algod_client/src/models/asset-holding-reference.js +0 -23
- package/packages/algod_client/src/models/asset-holding-reference.js.map +0 -1
- package/packages/algod_client/src/models/asset-holding-reference.mjs +0 -23
- package/packages/algod_client/src/models/asset-holding-reference.mjs.map +0 -1
- package/packages/algod_client/src/models/box-reference.d.ts +0 -17
- package/packages/algod_client/src/models/box-reference.js +0 -23
- package/packages/algod_client/src/models/box-reference.js.map +0 -1
- package/packages/algod_client/src/models/box-reference.mjs +0 -23
- package/packages/algod_client/src/models/box-reference.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-call.mjs","names":[],"sources":["../../../../../packages/transact/src/transactions/app-call.ts"],"sourcesContent":["import {\n MAX_ACCOUNT_REFERENCES,\n MAX_APP_ARGS,\n MAX_APP_REFERENCES,\n MAX_ARGS_SIZE,\n MAX_ASSET_REFERENCES,\n MAX_BOX_REFERENCES,\n MAX_EXTRA_PROGRAM_PAGES,\n MAX_GLOBAL_STATE_KEYS,\n MAX_LOCAL_STATE_KEYS,\n MAX_OVERALL_REFERENCES,\n PROGRAM_PAGE_SIZE,\n Address,\n} from '@algorandfoundation/algokit-common'\nimport { TransactionValidationError, TransactionValidationErrorType } from './common'\n\n/**\n * Represents an app call transaction that interacts with Algorand Smart Contracts.\n *\n * App call transactions are used to create, update, delete, opt-in to,\n * close out of, or clear state from Algorand apps (smart contracts).\n */\nexport type AppCallTransactionFields = {\n /**\n * ID of the app being called.\n *\n * Set this to 0 to indicate an app creation call.\n */\n appId: bigint\n\n /**\n * Defines what additional actions occur with the transaction.\n */\n onComplete: OnApplicationComplete\n\n /**\n * Logic executed for every app call transaction, except when\n * on-completion is set to \"clear\".\n *\n * Approval programs may reject the transaction.\n * Only required for app creation and update transactions.\n */\n approvalProgram?: Uint8Array\n\n /**\n * Logic executed for app call transactions with on-completion set to \"clear\".\n *\n * Clear state programs cannot reject the transaction.\n * Only required for app creation and update transactions.\n */\n clearStateProgram?: Uint8Array\n\n /**\n * Holds the maximum number of global state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n globalStateSchema?: StateSchema\n\n /**\n * Holds the maximum number of local state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n localStateSchema?: StateSchema\n\n /**\n * Number of additional pages allocated to the app's approval\n * and clear state programs.\n *\n * Each extra program page is 2048 bytes. The sum of approval program\n * and clear state program may not exceed 2048*(1+extra_program_pages) bytes.\n * Currently, the maximum value is 3.\n * This cannot be changed after creation.\n */\n extraProgramPages?: number\n\n /**\n * Transaction specific arguments available in the app's\n * approval program and clear state program.\n */\n args?: Uint8Array[]\n\n /**\n * List of accounts in addition to the sender that may be accessed\n * from the app's approval program and clear state program.\n */\n accountReferences?: Address[]\n\n /**\n * List of apps in addition to the current app that may be called\n * from the app's approval program and clear state program.\n */\n appReferences?: bigint[]\n\n /**\n * Lists the assets whose parameters may be accessed by this app's\n * approval program and clear state program.\n *\n * The access is read-only.\n */\n assetReferences?: bigint[]\n\n /**\n * The boxes that should be made available for the runtime of the program.\n */\n boxReferences?: BoxReference[]\n\n /**\n * Resources accessed by the application\n */\n accessReferences?: AccessReference[]\n\n /**\n * The lowest application version for which this transaction should immediately fail. 0 indicates that no version check should be performed.\n */\n rejectVersion?: number\n}\n\n/**\n * On-completion actions for application transactions.\n *\n * These values define what additional actions occur with the transaction.\n */\nexport enum OnApplicationComplete {\n /**\n * NoOp indicates that an app transaction will simply call its\n * approval program without any additional action.\n */\n NoOp,\n /**\n * OptIn indicates that an app transaction will allocate some\n * local state for the app in the sender's account.\n */\n OptIn,\n /**\n * CloseOut indicates that an app transaction will deallocate\n * some local state for the app from the user's account.\n */\n CloseOut,\n /**\n * ClearState is similar to CloseOut, but may never fail. This\n * allows users to reclaim their minimum balance from an app\n * they no longer wish to opt in to.\n */\n ClearState,\n /**\n * UpdateApplication indicates that an app transaction will\n * update the approval program and clear state program for the app.\n */\n UpdateApplication,\n /**\n * DeleteApplication indicates that an app transaction will\n * delete the app parameters for the app from the creator's\n * balance record.\n */\n DeleteApplication,\n}\n\n/**\n * Schema for app state storage.\n *\n * Defines the maximum number of values that may be stored in app\n * key/value storage for both global and local state.\n */\nexport type StateSchema = {\n /**\n * Maximum number of integer values that may be stored.\n */\n numUints: number\n\n /**\n * Maximum number of byte slice values that may be stored.\n */\n numByteSlices: number\n}\n\n/**\n * Box reference for app call transactions.\n *\n * References a specific box that should be made available for the runtime\n * of the program.\n */\nexport type BoxReference = {\n /**\n * App ID that owns the box.\n * A value of 0 indicates the current app.\n */\n appId: bigint\n\n /**\n * Name of the box.\n */\n name: Uint8Array\n}\n\n/**\n * Names a single resource reference. Only one of the fields should be set.\n */\nexport interface AccessReference {\n /** Any account addresses whose balance record is accessible by the executing ApprovalProgram or ClearStateProgram. */\n address?: Address\n /** Application ID whose GlobalState may be read by the executing ApprovalProgram or ClearStateProgram. */\n appId?: bigint\n /** Asset ID whose AssetParams may be read by the executing ApprovalProgram or ClearStateProgram. */\n assetId?: bigint\n /** Defines a holding by referring to an Address and Asset it belongs to. */\n holding?: HoldingReference\n /** Defines a local state by referring to an Address and App it belongs to. */\n locals?: LocalsReference\n /** Defines a box by its name and the application ID it belongs to. */\n box?: BoxReference\n}\n\n/**\n * A grouping of the asset index and address of the account\n */\nexport interface HoldingReference {\n /** The asset index of the holding */\n assetId: bigint\n\n /** The address of the account holding the asset */\n address: Address\n}\n\n/** A grouping of the application index and address of the account\n */\nexport interface LocalsReference {\n /** The application index of the local state */\n appId: bigint\n\n /** The address of the account holding the local state */\n address: Address\n}\n\nconst FIELD_ARGS = 'Args'\nconst FIELD_APPROVAL_PROGRAM = 'Approval program'\nconst FIELD_CLEAR_STATE_PROGRAM = 'Clear state program'\nconst FIELD_GLOBAL_STATE_SCHEMA = 'Global state schema'\nconst FIELD_LOCAL_STATE_SCHEMA = 'Local state schema'\nconst FIELD_EXTRA_PROGRAM_PAGES = 'Extra program pages'\n\n/**\n * Validate app call transaction fields\n */\nexport function validateAppCallTransaction(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.appId === 0n) {\n // App creation\n errors.push(...validateAppCreation(appCall))\n } else {\n // App call, update, or delete\n errors.push(...validateAppOperation(appCall))\n }\n\n // Common validations for all app operations\n errors.push(...validateAppCommonFields(appCall))\n\n return errors\n}\n\n/**\n * Validate app creation fields\n */\nfunction validateAppCreation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_APPROVAL_PROGRAM,\n })\n }\n\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_CLEAR_STATE_PROGRAM,\n })\n }\n\n const extraPages = appCall.extraProgramPages ?? 0\n if (extraPages > MAX_EXTRA_PROGRAM_PAGES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_EXTRA_PROGRAM_PAGES,\n actual: extraPages,\n max: MAX_EXTRA_PROGRAM_PAGES,\n unit: 'pages',\n },\n })\n }\n\n const maxProgramSize = PROGRAM_PAGE_SIZE + extraPages * PROGRAM_PAGE_SIZE\n\n if (appCall.approvalProgram && appCall.approvalProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_APPROVAL_PROGRAM,\n actual: appCall.approvalProgram.length,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n if (appCall.clearStateProgram && appCall.clearStateProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_CLEAR_STATE_PROGRAM,\n actual: appCall.clearStateProgram.length,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n const totalProgramSize = (appCall.approvalProgram?.length ?? 0) + (appCall.clearStateProgram?.length ?? 0)\n if (totalProgramSize > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Combined approval and clear state programs',\n actual: totalProgramSize,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n if (appCall.globalStateSchema) {\n const totalKeys = appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices\n if (totalKeys > MAX_GLOBAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_GLOBAL_STATE_SCHEMA,\n actual: appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices,\n max: MAX_GLOBAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n if (appCall.localStateSchema) {\n const totalKeys = appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices\n if (totalKeys > MAX_LOCAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_LOCAL_STATE_SCHEMA,\n actual: appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices,\n max: MAX_LOCAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n return errors\n}\n\n/**\n * Validate app operation (update, delete, call) fields\n */\nfunction validateAppOperation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.onComplete === OnApplicationComplete.UpdateApplication) {\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_APPROVAL_PROGRAM,\n })\n }\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_CLEAR_STATE_PROGRAM,\n })\n }\n }\n\n // These fields are immutable and cannot be set for existing apps\n if (appCall.globalStateSchema !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_GLOBAL_STATE_SCHEMA,\n })\n }\n if (appCall.localStateSchema !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_LOCAL_STATE_SCHEMA,\n })\n }\n if (appCall.extraProgramPages !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_EXTRA_PROGRAM_PAGES,\n })\n }\n\n return errors\n}\n\n/**\n * Validate common app call fields\n */\nfunction validateAppCommonFields(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.args) {\n if (appCall.args.length > MAX_APP_ARGS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_ARGS,\n actual: appCall.args.length,\n max: MAX_APP_ARGS,\n unit: 'arguments',\n },\n })\n }\n\n const totalArgsSize = appCall.args.reduce((sum, arg) => sum + arg.length, 0)\n if (totalArgsSize > MAX_ARGS_SIZE) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Args total size',\n actual: totalArgsSize,\n max: MAX_ARGS_SIZE,\n unit: 'bytes',\n },\n })\n }\n }\n\n if (appCall.accountReferences && appCall.accountReferences.length > MAX_ACCOUNT_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Account references',\n actual: appCall.accountReferences.length,\n max: MAX_ACCOUNT_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n if (appCall.appReferences && appCall.appReferences.length > MAX_APP_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'App references',\n actual: appCall.appReferences.length,\n max: MAX_APP_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n if (appCall.assetReferences && appCall.assetReferences.length > MAX_ASSET_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Asset references',\n actual: appCall.assetReferences.length,\n max: MAX_ASSET_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n // Validate box references\n if (appCall.boxReferences) {\n if (appCall.boxReferences.length > MAX_BOX_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Box references',\n actual: appCall.boxReferences.length,\n max: MAX_BOX_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n // Validate that box reference app IDs are in app references\n const appRefs = appCall.appReferences || []\n for (const boxRef of appCall.boxReferences) {\n if (boxRef.appId !== 0n && boxRef.appId !== appCall.appId && !appRefs.includes(boxRef.appId)) {\n errors.push({\n type: TransactionValidationErrorType.ArbitraryConstraint,\n data: `Box reference for app ID ${boxRef.appId} must be in app references`,\n })\n }\n }\n }\n\n // Validate overall reference count\n const totalReferences =\n (appCall.accountReferences?.length || 0) +\n (appCall.appReferences?.length || 0) +\n (appCall.assetReferences?.length || 0) +\n (appCall.boxReferences?.length || 0)\n\n if (totalReferences > MAX_OVERALL_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Total references',\n actual: totalReferences,\n max: MAX_OVERALL_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n return errors\n}\n"],"mappings":";;;;;;;;;AA8HA,IAAY,0EAAL;;;;;AAKL;;;;;AAKA;;;;;AAKA;;;;;;AAMA;;;;;AAKA;;;;;;AAMA;;;AA+EF,MAAM,aAAa;AACnB,MAAM,yBAAyB;AAC/B,MAAM,4BAA4B;AAClC,MAAM,4BAA4B;AAClC,MAAM,2BAA2B;AACjC,MAAM,4BAA4B;;;;AAKlC,SAAgB,2BAA2B,SAAiE;CAC1G,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,QAAQ,UAAU,GAEpB,QAAO,KAAK,GAAG,oBAAoB,QAAQ,CAAC;KAG5C,QAAO,KAAK,GAAG,qBAAqB,QAAQ,CAAC;AAI/C,QAAO,KAAK,GAAG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,UAAU,MACnC,QAAQ,eAAe,UAAU;AAEpC,KAAI,kBAAkB,uBACpB,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;GACJ,OAAO;GACP,QAAQ;GACR,KAAK;GACL,MAAM;GACP;EACF,CAAC;AAGJ,QAAO"}
|
|
1
|
+
{"version":3,"file":"app-call.mjs","names":[],"sources":["../../../../../packages/transact/src/transactions/app-call.ts"],"sourcesContent":["import {\n Address,\n MAX_ACCOUNT_REFERENCES,\n MAX_APP_ARGS,\n MAX_APP_REFERENCES,\n MAX_ARGS_SIZE,\n MAX_ASSET_REFERENCES,\n MAX_BOX_REFERENCES,\n MAX_EXTRA_PROGRAM_PAGES,\n MAX_GLOBAL_STATE_KEYS,\n MAX_LOCAL_STATE_KEYS,\n MAX_OVERALL_REFERENCES,\n PROGRAM_PAGE_SIZE,\n} from '@algorandfoundation/algokit-common'\nimport { TransactionValidationError, TransactionValidationErrorType } from './common'\n\n/**\n * Represents an app call transaction that interacts with Algorand Smart Contracts.\n *\n * App call transactions are used to create, update, delete, opt-in to,\n * close out of, or clear state from Algorand apps (smart contracts).\n */\nexport type AppCallTransactionFields = {\n /**\n * ID of the app being called.\n *\n * Set this to 0 to indicate an app creation call.\n */\n appId: bigint\n\n /**\n * Defines what additional actions occur with the transaction.\n */\n onComplete: OnApplicationComplete\n\n /**\n * Logic executed for every app call transaction, except when\n * on-completion is set to \"clear\".\n *\n * Approval programs may reject the transaction.\n * Only required for app creation and update transactions.\n */\n approvalProgram?: Uint8Array\n\n /**\n * Logic executed for app call transactions with on-completion set to \"clear\".\n *\n * Clear state programs cannot reject the transaction.\n * Only required for app creation and update transactions.\n */\n clearStateProgram?: Uint8Array\n\n /**\n * Holds the maximum number of global state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n globalStateSchema?: StateSchema\n\n /**\n * Holds the maximum number of local state values.\n *\n * Only required for app creation transactions.\n * This cannot be changed after creation.\n */\n localStateSchema?: StateSchema\n\n /**\n * Number of additional pages allocated to the app's approval\n * and clear state programs.\n *\n * Each extra program page is 2048 bytes. The sum of approval program\n * and clear state program may not exceed 2048*(1+extra_program_pages) bytes.\n * Currently, the maximum value is 3.\n * This cannot be changed after creation.\n */\n extraProgramPages?: number\n\n /**\n * Transaction specific arguments available in the app's\n * approval program and clear state program.\n */\n args?: Uint8Array[]\n\n /**\n * List of accounts in addition to the sender that may be accessed\n * from the app's approval program and clear state program.\n */\n accountReferences?: Address[]\n\n /**\n * List of apps in addition to the current app that may be called\n * from the app's approval program and clear state program.\n */\n appReferences?: bigint[]\n\n /**\n * Lists the assets whose parameters may be accessed by this app's\n * approval program and clear state program.\n *\n * The access is read-only.\n */\n assetReferences?: bigint[]\n\n /**\n * The boxes that should be made available for the runtime of the program.\n */\n boxReferences?: BoxReference[]\n\n /**\n * Resources accessed by the application\n */\n accessReferences?: ResourceReference[]\n\n /**\n * The lowest application version for which this transaction should immediately fail. 0 indicates that no version check should be performed.\n */\n rejectVersion?: number\n}\n\n/**\n * On-completion actions for application transactions.\n *\n * These values define what additional actions occur with the transaction.\n */\nexport enum OnApplicationComplete {\n /**\n * NoOp indicates that an app transaction will simply call its\n * approval program without any additional action.\n */\n NoOp,\n /**\n * OptIn indicates that an app transaction will allocate some\n * local state for the app in the sender's account.\n */\n OptIn,\n /**\n * CloseOut indicates that an app transaction will deallocate\n * some local state for the app from the user's account.\n */\n CloseOut,\n /**\n * ClearState is similar to CloseOut, but may never fail. This\n * allows users to reclaim their minimum balance from an app\n * they no longer wish to opt in to.\n */\n ClearState,\n /**\n * UpdateApplication indicates that an app transaction will\n * update the approval program and clear state program for the app.\n */\n UpdateApplication,\n /**\n * DeleteApplication indicates that an app transaction will\n * delete the app parameters for the app from the creator's\n * balance record.\n */\n DeleteApplication,\n}\n\n/**\n * Schema for app state storage.\n *\n * Defines the maximum number of values that may be stored in app\n * key/value storage for both global and local state.\n */\nexport type StateSchema = {\n /**\n * Maximum number of integer values that may be stored.\n */\n numUints: number\n\n /**\n * Maximum number of byte slice values that may be stored.\n */\n numByteSlices: number\n}\n\n/**\n * Box reference for app call transactions.\n *\n * References a specific box that should be made available for the runtime\n * of the program.\n */\nexport type BoxReference = {\n /**\n * App ID that owns the box.\n * A value of 0 indicates the current app.\n */\n appId: bigint\n\n /**\n * Name of the box.\n */\n name: Uint8Array\n}\n\n/**\n * Names a single resource reference. Only one of the fields should be set.\n */\nexport type ResourceReference = {\n /** Any account addresses whose balance record is accessible by the executing ApprovalProgram or ClearStateProgram. */\n address?: Address\n /** Application ID whose GlobalState may be read by the executing ApprovalProgram or ClearStateProgram. */\n appId?: bigint\n /** Asset ID whose AssetParams may be read by the executing ApprovalProgram or ClearStateProgram. */\n assetId?: bigint\n /** Defines a holding by referring to an Address and Asset it belongs to. */\n holding?: HoldingReference\n /** Defines a local state by referring to an Address and App it belongs to. */\n locals?: LocalsReference\n /** Defines a box by its name and the application ID it belongs to. */\n box?: BoxReference\n}\n\n/**\n * A grouping of the asset index and address of the account\n */\nexport type HoldingReference = {\n /** The asset index of the holding */\n assetId: bigint\n\n /** The address of the account holding the asset */\n address: Address\n}\n\n/** A grouping of the application index and address of the account\n */\nexport type LocalsReference = {\n /** The application index of the local state */\n appId: bigint\n\n /** The address of the account holding the local state */\n address: Address\n}\n\nconst FIELD_ARGS = 'Args'\nconst FIELD_APPROVAL_PROGRAM = 'Approval program'\nconst FIELD_CLEAR_STATE_PROGRAM = 'Clear state program'\nconst FIELD_GLOBAL_STATE_SCHEMA = 'Global state schema'\nconst FIELD_LOCAL_STATE_SCHEMA = 'Local state schema'\nconst FIELD_EXTRA_PROGRAM_PAGES = 'Extra program pages'\n\n/**\n * Validate app call transaction fields\n */\nexport function validateAppCallTransaction(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.appId === 0n) {\n // App creation\n errors.push(...validateAppCreation(appCall))\n } else {\n // App call, update, or delete\n errors.push(...validateAppOperation(appCall))\n }\n\n // Common validations for all app operations\n errors.push(...validateAppCommonFields(appCall))\n\n return errors\n}\n\n/**\n * Validate app creation fields\n */\nfunction validateAppCreation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_APPROVAL_PROGRAM,\n })\n }\n\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_CLEAR_STATE_PROGRAM,\n })\n }\n\n const extraPages = appCall.extraProgramPages ?? 0\n if (extraPages > MAX_EXTRA_PROGRAM_PAGES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_EXTRA_PROGRAM_PAGES,\n actual: extraPages,\n max: MAX_EXTRA_PROGRAM_PAGES,\n unit: 'pages',\n },\n })\n }\n\n const maxProgramSize = PROGRAM_PAGE_SIZE + extraPages * PROGRAM_PAGE_SIZE\n\n if (appCall.approvalProgram && appCall.approvalProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_APPROVAL_PROGRAM,\n actual: appCall.approvalProgram.length,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n if (appCall.clearStateProgram && appCall.clearStateProgram.length > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_CLEAR_STATE_PROGRAM,\n actual: appCall.clearStateProgram.length,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n const totalProgramSize = (appCall.approvalProgram?.length ?? 0) + (appCall.clearStateProgram?.length ?? 0)\n if (totalProgramSize > maxProgramSize) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Combined approval and clear state programs',\n actual: totalProgramSize,\n max: maxProgramSize,\n unit: 'bytes',\n },\n })\n }\n\n if (appCall.globalStateSchema) {\n const totalKeys = appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices\n if (totalKeys > MAX_GLOBAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_GLOBAL_STATE_SCHEMA,\n actual: appCall.globalStateSchema.numUints + appCall.globalStateSchema.numByteSlices,\n max: MAX_GLOBAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n if (appCall.localStateSchema) {\n const totalKeys = appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices\n if (totalKeys > MAX_LOCAL_STATE_KEYS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_LOCAL_STATE_SCHEMA,\n actual: appCall.localStateSchema.numUints + appCall.localStateSchema.numByteSlices,\n max: MAX_LOCAL_STATE_KEYS,\n unit: 'keys',\n },\n })\n }\n }\n\n return errors\n}\n\n/**\n * Validate app operation (update, delete, call) fields\n */\nfunction validateAppOperation(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.onComplete === OnApplicationComplete.UpdateApplication) {\n if (!appCall.approvalProgram || appCall.approvalProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_APPROVAL_PROGRAM,\n })\n }\n if (!appCall.clearStateProgram || appCall.clearStateProgram.length === 0) {\n errors.push({\n type: TransactionValidationErrorType.RequiredField,\n data: FIELD_CLEAR_STATE_PROGRAM,\n })\n }\n }\n\n // These fields are immutable and cannot be set for existing apps\n if (appCall.globalStateSchema !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_GLOBAL_STATE_SCHEMA,\n })\n }\n if (appCall.localStateSchema !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_LOCAL_STATE_SCHEMA,\n })\n }\n if (appCall.extraProgramPages !== undefined) {\n errors.push({\n type: TransactionValidationErrorType.ImmutableField,\n data: FIELD_EXTRA_PROGRAM_PAGES,\n })\n }\n\n return errors\n}\n\n/**\n * Validate common app call fields\n */\nfunction validateAppCommonFields(appCall: AppCallTransactionFields): TransactionValidationError[] {\n const errors = new Array<TransactionValidationError>()\n\n if (appCall.args) {\n if (appCall.args.length > MAX_APP_ARGS) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: FIELD_ARGS,\n actual: appCall.args.length,\n max: MAX_APP_ARGS,\n unit: 'arguments',\n },\n })\n }\n\n const totalArgsSize = appCall.args.reduce((sum, arg) => sum + arg.length, 0)\n if (totalArgsSize > MAX_ARGS_SIZE) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Args total size',\n actual: totalArgsSize,\n max: MAX_ARGS_SIZE,\n unit: 'bytes',\n },\n })\n }\n }\n\n if (appCall.accountReferences && appCall.accountReferences.length > MAX_ACCOUNT_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Account references',\n actual: appCall.accountReferences.length,\n max: MAX_ACCOUNT_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n if (appCall.appReferences && appCall.appReferences.length > MAX_APP_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'App references',\n actual: appCall.appReferences.length,\n max: MAX_APP_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n if (appCall.assetReferences && appCall.assetReferences.length > MAX_ASSET_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Asset references',\n actual: appCall.assetReferences.length,\n max: MAX_ASSET_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n // Validate box references\n if (appCall.boxReferences) {\n if (appCall.boxReferences.length > MAX_BOX_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Box references',\n actual: appCall.boxReferences.length,\n max: MAX_BOX_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n // Validate that box reference app IDs are in app references\n const appRefs = appCall.appReferences || []\n for (const boxRef of appCall.boxReferences) {\n if (boxRef.appId !== 0n && boxRef.appId !== appCall.appId && !appRefs.includes(boxRef.appId)) {\n errors.push({\n type: TransactionValidationErrorType.ArbitraryConstraint,\n data: `Box reference for app ID ${boxRef.appId} must be in app references`,\n })\n }\n }\n }\n\n // Validate overall reference count\n const totalReferences =\n (appCall.accountReferences?.length || 0) +\n (appCall.appReferences?.length || 0) +\n (appCall.assetReferences?.length || 0) +\n (appCall.boxReferences?.length || 0)\n\n if (totalReferences > MAX_OVERALL_REFERENCES) {\n errors.push({\n type: TransactionValidationErrorType.FieldTooLong,\n data: {\n field: 'Total references',\n actual: totalReferences,\n max: MAX_OVERALL_REFERENCES,\n unit: 'refs',\n },\n })\n }\n\n return errors\n}\n"],"mappings":";;;;;;;;;AA8HA,IAAY,0EAAL;;;;;AAKL;;;;;AAKA;;;;;AAKA;;;;;;AAMA;;;;;AAKA;;;;;;AAMA;;;AA+EF,MAAM,aAAa;AACnB,MAAM,yBAAyB;AAC/B,MAAM,4BAA4B;AAClC,MAAM,4BAA4B;AAClC,MAAM,2BAA2B;AACjC,MAAM,4BAA4B;;;;AAKlC,SAAgB,2BAA2B,SAAiE;CAC1G,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,QAAQ,UAAU,GAEpB,QAAO,KAAK,GAAG,oBAAoB,QAAQ,CAAC;KAG5C,QAAO,KAAK,GAAG,qBAAqB,QAAQ,CAAC;AAI/C,QAAO,KAAK,GAAG,wBAAwB,QAAQ,CAAC;AAEhD,QAAO;;;;;AAMT,SAAS,oBAAoB,SAAiE;CAC5F,MAAM,SAAS,IAAI,OAAmC;AAEtD,KAAI,CAAC,QAAQ,mBAAmB,QAAQ,gBAAgB,WAAW,EACjE,QAAO,KAAK;EACV,MAAM,+BAA+B;EACrC,MAAM;EACP,CAAC;AAGJ,KAAI,CAAC,QAAQ,qBAAqB,QAAQ,kBAAkB,WAAW,EAC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ference, HoldingReference, LocalsReference } from "./app-call.js";
|
|
3
|
+
|
|
4
|
+
//#region packages/transact/src/transactions/reference-types-meta.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Metadata for BoxReference
|
|
8
|
+
*
|
|
9
|
+
* Maps wire format (app, name) to BoxReference (appId, name)
|
|
10
|
+
*/
|
|
11
|
+
declare const BoxReferenceMeta: ObjectModelMetadata<BoxReference>;
|
|
12
|
+
/**
|
|
13
|
+
* Metadata for HoldingReference
|
|
14
|
+
*
|
|
15
|
+
* Maps wire format (account, asset) to HoldingReference (address, assetId)
|
|
16
|
+
*/
|
|
17
|
+
declare const HoldingReferenceMeta: ObjectModelMetadata<HoldingReference>;
|
|
18
|
+
/**
|
|
19
|
+
* Metadata for LocalsReference
|
|
20
|
+
*
|
|
21
|
+
* Maps wire format (account, app) to LocalsReference (address, appId)
|
|
22
|
+
*/
|
|
23
|
+
declare const LocalsReferenceMeta: ObjectModelMetadata<LocalsReference>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { BoxReferenceMeta, HoldingReferenceMeta, LocalsReferenceMeta };
|
|
26
|
+
//# sourceMappingURL=reference-types-meta.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const require_address = require('../../../common/src/codecs/primitives/address.js');
|
|
2
|
+
const require_bigint = require('../../../common/src/codecs/primitives/bigint.js');
|
|
3
|
+
const require_bytes = require('../../../common/src/codecs/primitives/bytes.js');
|
|
4
|
+
|
|
5
|
+
//#region packages/transact/src/transactions/reference-types-meta.ts
|
|
6
|
+
/**
|
|
7
|
+
* Metadata for BoxReference
|
|
8
|
+
*
|
|
9
|
+
* Maps wire format (app, name) to BoxReference (appId, name)
|
|
10
|
+
*/
|
|
11
|
+
const BoxReferenceMeta = {
|
|
12
|
+
name: "BoxReference",
|
|
13
|
+
kind: "object",
|
|
14
|
+
fields: [{
|
|
15
|
+
name: "appId",
|
|
16
|
+
wireKey: "app",
|
|
17
|
+
optional: false,
|
|
18
|
+
codec: require_bigint.bigIntCodec
|
|
19
|
+
}, {
|
|
20
|
+
name: "name",
|
|
21
|
+
wireKey: "name",
|
|
22
|
+
optional: false,
|
|
23
|
+
codec: require_bytes.bytesCodec
|
|
24
|
+
}]
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Metadata for HoldingReference
|
|
28
|
+
*
|
|
29
|
+
* Maps wire format (account, asset) to HoldingReference (address, assetId)
|
|
30
|
+
*/
|
|
31
|
+
const HoldingReferenceMeta = {
|
|
32
|
+
name: "HoldingReference",
|
|
33
|
+
kind: "object",
|
|
34
|
+
fields: [{
|
|
35
|
+
name: "address",
|
|
36
|
+
wireKey: "account",
|
|
37
|
+
optional: false,
|
|
38
|
+
codec: require_address.addressCodec
|
|
39
|
+
}, {
|
|
40
|
+
name: "assetId",
|
|
41
|
+
wireKey: "asset",
|
|
42
|
+
optional: false,
|
|
43
|
+
codec: require_bigint.bigIntCodec
|
|
44
|
+
}]
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Metadata for LocalsReference
|
|
48
|
+
*
|
|
49
|
+
* Maps wire format (account, app) to LocalsReference (address, appId)
|
|
50
|
+
*/
|
|
51
|
+
const LocalsReferenceMeta = {
|
|
52
|
+
name: "LocalsReference",
|
|
53
|
+
kind: "object",
|
|
54
|
+
fields: [{
|
|
55
|
+
name: "address",
|
|
56
|
+
wireKey: "account",
|
|
57
|
+
optional: false,
|
|
58
|
+
codec: require_address.addressCodec
|
|
59
|
+
}, {
|
|
60
|
+
name: "appId",
|
|
61
|
+
wireKey: "app",
|
|
62
|
+
optional: false,
|
|
63
|
+
codec: require_bigint.bigIntCodec
|
|
64
|
+
}]
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
exports.BoxReferenceMeta = BoxReferenceMeta;
|
|
69
|
+
exports.HoldingReferenceMeta = HoldingReferenceMeta;
|
|
70
|
+
exports.LocalsReferenceMeta = LocalsReferenceMeta;
|
|
71
|
+
//# sourceMappingURL=reference-types-meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-types-meta.js","names":["BoxReferenceMeta: ObjectModelMetadata<BoxReference>","bigIntCodec","bytesCodec","HoldingReferenceMeta: ObjectModelMetadata<HoldingReference>","addressCodec","LocalsReferenceMeta: ObjectModelMetadata<LocalsReference>"],"sources":["../../../../../packages/transact/src/transactions/reference-types-meta.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { addressCodec, bigIntCodec, bytesCodec } from '@algorandfoundation/algokit-common'\nimport type { BoxReference, HoldingReference, LocalsReference } from './app-call'\n\n/**\n * Metadata for BoxReference\n *\n * Maps wire format (app, name) to BoxReference (appId, name)\n */\nexport const BoxReferenceMeta: ObjectModelMetadata<BoxReference> = {\n name: 'BoxReference',\n kind: 'object',\n fields: [\n { name: 'appId', wireKey: 'app', optional: false, codec: bigIntCodec },\n { name: 'name', wireKey: 'name', optional: false, codec: bytesCodec },\n ],\n}\n\n/**\n * Metadata for HoldingReference\n *\n * Maps wire format (account, asset) to HoldingReference (address, assetId)\n */\nexport const HoldingReferenceMeta: ObjectModelMetadata<HoldingReference> = {\n name: 'HoldingReference',\n kind: 'object',\n fields: [\n { name: 'address', wireKey: 'account', optional: false, codec: addressCodec },\n { name: 'assetId', wireKey: 'asset', optional: false, codec: bigIntCodec },\n ],\n}\n\n/**\n * Metadata for LocalsReference\n *\n * Maps wire format (account, app) to LocalsReference (address, appId)\n */\nexport const LocalsReferenceMeta: ObjectModelMetadata<LocalsReference> = {\n name: 'LocalsReference',\n kind: 'object',\n fields: [\n { name: 'address', wireKey: 'account', optional: false, codec: addressCodec },\n { name: 'appId', wireKey: 'app', optional: false, codec: bigIntCodec },\n ],\n}\n"],"mappings":";;;;;;;;;;AASA,MAAaA,mBAAsD;CACjE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAS,SAAS;EAAO,UAAU;EAAO,OAAOC;EAAa,EACtE;EAAE,MAAM;EAAQ,SAAS;EAAQ,UAAU;EAAO,OAAOC;EAAY,CACtE;CACF;;;;;;AAOD,MAAaC,uBAA8D;CACzE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAW,SAAS;EAAW,UAAU;EAAO,OAAOC;EAAc,EAC7E;EAAE,MAAM;EAAW,SAAS;EAAS,UAAU;EAAO,OAAOH;EAAa,CAC3E;CACF;;;;;;AAOD,MAAaI,sBAA4D;CACvE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAW,SAAS;EAAW,UAAU;EAAO,OAAOD;EAAc,EAC7E;EAAE,MAAM;EAAS,SAAS;EAAO,UAAU;EAAO,OAAOH;EAAa,CACvE;CACF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { addressCodec } from "../../../common/src/codecs/primitives/address.mjs";
|
|
2
|
+
import { bigIntCodec } from "../../../common/src/codecs/primitives/bigint.mjs";
|
|
3
|
+
import { bytesCodec } from "../../../common/src/codecs/primitives/bytes.mjs";
|
|
4
|
+
|
|
5
|
+
//#region packages/transact/src/transactions/reference-types-meta.ts
|
|
6
|
+
/**
|
|
7
|
+
* Metadata for BoxReference
|
|
8
|
+
*
|
|
9
|
+
* Maps wire format (app, name) to BoxReference (appId, name)
|
|
10
|
+
*/
|
|
11
|
+
const BoxReferenceMeta = {
|
|
12
|
+
name: "BoxReference",
|
|
13
|
+
kind: "object",
|
|
14
|
+
fields: [{
|
|
15
|
+
name: "appId",
|
|
16
|
+
wireKey: "app",
|
|
17
|
+
optional: false,
|
|
18
|
+
codec: bigIntCodec
|
|
19
|
+
}, {
|
|
20
|
+
name: "name",
|
|
21
|
+
wireKey: "name",
|
|
22
|
+
optional: false,
|
|
23
|
+
codec: bytesCodec
|
|
24
|
+
}]
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Metadata for HoldingReference
|
|
28
|
+
*
|
|
29
|
+
* Maps wire format (account, asset) to HoldingReference (address, assetId)
|
|
30
|
+
*/
|
|
31
|
+
const HoldingReferenceMeta = {
|
|
32
|
+
name: "HoldingReference",
|
|
33
|
+
kind: "object",
|
|
34
|
+
fields: [{
|
|
35
|
+
name: "address",
|
|
36
|
+
wireKey: "account",
|
|
37
|
+
optional: false,
|
|
38
|
+
codec: addressCodec
|
|
39
|
+
}, {
|
|
40
|
+
name: "assetId",
|
|
41
|
+
wireKey: "asset",
|
|
42
|
+
optional: false,
|
|
43
|
+
codec: bigIntCodec
|
|
44
|
+
}]
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Metadata for LocalsReference
|
|
48
|
+
*
|
|
49
|
+
* Maps wire format (account, app) to LocalsReference (address, appId)
|
|
50
|
+
*/
|
|
51
|
+
const LocalsReferenceMeta = {
|
|
52
|
+
name: "LocalsReference",
|
|
53
|
+
kind: "object",
|
|
54
|
+
fields: [{
|
|
55
|
+
name: "address",
|
|
56
|
+
wireKey: "account",
|
|
57
|
+
optional: false,
|
|
58
|
+
codec: addressCodec
|
|
59
|
+
}, {
|
|
60
|
+
name: "appId",
|
|
61
|
+
wireKey: "app",
|
|
62
|
+
optional: false,
|
|
63
|
+
codec: bigIntCodec
|
|
64
|
+
}]
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { BoxReferenceMeta, HoldingReferenceMeta, LocalsReferenceMeta };
|
|
69
|
+
//# sourceMappingURL=reference-types-meta.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-types-meta.mjs","names":["BoxReferenceMeta: ObjectModelMetadata<BoxReference>","HoldingReferenceMeta: ObjectModelMetadata<HoldingReference>","LocalsReferenceMeta: ObjectModelMetadata<LocalsReference>"],"sources":["../../../../../packages/transact/src/transactions/reference-types-meta.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { addressCodec, bigIntCodec, bytesCodec } from '@algorandfoundation/algokit-common'\nimport type { BoxReference, HoldingReference, LocalsReference } from './app-call'\n\n/**\n * Metadata for BoxReference\n *\n * Maps wire format (app, name) to BoxReference (appId, name)\n */\nexport const BoxReferenceMeta: ObjectModelMetadata<BoxReference> = {\n name: 'BoxReference',\n kind: 'object',\n fields: [\n { name: 'appId', wireKey: 'app', optional: false, codec: bigIntCodec },\n { name: 'name', wireKey: 'name', optional: false, codec: bytesCodec },\n ],\n}\n\n/**\n * Metadata for HoldingReference\n *\n * Maps wire format (account, asset) to HoldingReference (address, assetId)\n */\nexport const HoldingReferenceMeta: ObjectModelMetadata<HoldingReference> = {\n name: 'HoldingReference',\n kind: 'object',\n fields: [\n { name: 'address', wireKey: 'account', optional: false, codec: addressCodec },\n { name: 'assetId', wireKey: 'asset', optional: false, codec: bigIntCodec },\n ],\n}\n\n/**\n * Metadata for LocalsReference\n *\n * Maps wire format (account, app) to LocalsReference (address, appId)\n */\nexport const LocalsReferenceMeta: ObjectModelMetadata<LocalsReference> = {\n name: 'LocalsReference',\n kind: 'object',\n fields: [\n { name: 'address', wireKey: 'account', optional: false, codec: addressCodec },\n { name: 'appId', wireKey: 'app', optional: false, codec: bigIntCodec },\n ],\n}\n"],"mappings":";;;;;;;;;;AASA,MAAaA,mBAAsD;CACjE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAS,SAAS;EAAO,UAAU;EAAO,OAAO;EAAa,EACtE;EAAE,MAAM;EAAQ,SAAS;EAAQ,UAAU;EAAO,OAAO;EAAY,CACtE;CACF;;;;;;AAOD,MAAaC,uBAA8D;CACzE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAW,SAAS;EAAW,UAAU;EAAO,OAAO;EAAc,EAC7E;EAAE,MAAM;EAAW,SAAS;EAAS,UAAU;EAAO,OAAO;EAAa,CAC3E;CACF;;;;;;AAOD,MAAaC,sBAA4D;CACvE,MAAM;CACN,MAAM;CACN,QAAQ,CACN;EAAE,MAAM;EAAW,SAAS;EAAW,UAAU;EAAO,OAAO;EAAc,EAC7E;EAAE,MAAM;EAAS,SAAS;EAAO,UAAU;EAAO,OAAO;EAAa,CACvE;CACF"}
|
|
@@ -93,8 +93,8 @@ var AssetConfigDataCodec = class extends require_codec.Codec {
|
|
|
93
93
|
var AppCallDataCodec = class extends require_codec.Codec {
|
|
94
94
|
appCallFieldsCodec = new require_object_model.ObjectModelCodec(AppCallTransactionFieldsMeta);
|
|
95
95
|
defaultValue() {}
|
|
96
|
-
|
|
97
|
-
if (!
|
|
96
|
+
encodeResourceReferences(appId, resourceReferences, format) {
|
|
97
|
+
if (!resourceReferences || resourceReferences.length === 0) return void 0;
|
|
98
98
|
const accessList = [];
|
|
99
99
|
const ensure = (target) => {
|
|
100
100
|
for (let idx = 0; idx < accessList.length; idx++) {
|
|
@@ -109,13 +109,13 @@ var AppCallDataCodec = class extends require_codec.Codec {
|
|
|
109
109
|
if (target.appId !== void 0) accessList.push({ p: require_bigint.bigIntCodec.encodeOptional(target.appId, format) });
|
|
110
110
|
return accessList.length;
|
|
111
111
|
};
|
|
112
|
-
for (const
|
|
113
|
-
if (
|
|
114
|
-
ensure(
|
|
112
|
+
for (const resourceRef of resourceReferences) {
|
|
113
|
+
if (resourceRef.address || resourceRef.assetId !== void 0 || resourceRef.appId !== void 0) {
|
|
114
|
+
ensure(resourceRef);
|
|
115
115
|
continue;
|
|
116
116
|
}
|
|
117
|
-
if (
|
|
118
|
-
const holding =
|
|
117
|
+
if (resourceRef.holding) {
|
|
118
|
+
const holding = resourceRef.holding;
|
|
119
119
|
let addressIndex = 0;
|
|
120
120
|
if (holding.address && !holding.address.equals(require_address.Address.zeroAddress())) addressIndex = ensure({ address: holding.address });
|
|
121
121
|
const assetIndex = ensure({ assetId: holding.assetId });
|
|
@@ -125,8 +125,8 @@ var AppCallDataCodec = class extends require_codec.Codec {
|
|
|
125
125
|
} });
|
|
126
126
|
continue;
|
|
127
127
|
}
|
|
128
|
-
if (
|
|
129
|
-
const locals =
|
|
128
|
+
if (resourceRef.locals) {
|
|
129
|
+
const locals = resourceRef.locals;
|
|
130
130
|
let addressIndex = 0;
|
|
131
131
|
if (locals.address && !locals.address.equals(require_address.Address.zeroAddress())) addressIndex = ensure({ address: locals.address });
|
|
132
132
|
let appIndex = 0;
|
|
@@ -137,8 +137,8 @@ var AppCallDataCodec = class extends require_codec.Codec {
|
|
|
137
137
|
} });
|
|
138
138
|
continue;
|
|
139
139
|
}
|
|
140
|
-
if (
|
|
141
|
-
const box =
|
|
140
|
+
if (resourceRef.box) {
|
|
141
|
+
const box = resourceRef.box;
|
|
142
142
|
let appIndex = 0;
|
|
143
143
|
if (box.appId && box.appId !== appId) appIndex = ensure({ appId: box.appId });
|
|
144
144
|
accessList.push({ b: {
|
|
@@ -150,11 +150,11 @@ var AppCallDataCodec = class extends require_codec.Codec {
|
|
|
150
150
|
}
|
|
151
151
|
return accessList.length > 0 ? accessList : void 0;
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
if (!
|
|
153
|
+
decodeResourceReferences(_wireResourceReferences, format) {
|
|
154
|
+
if (!_wireResourceReferences || _wireResourceReferences.length === 0) return [];
|
|
155
155
|
const result = [];
|
|
156
|
-
const
|
|
157
|
-
for (const ref of
|
|
156
|
+
const wireResourceReferences = _wireResourceReferences.map((ref) => require_wire.normalizeWireObject(ref));
|
|
157
|
+
for (const ref of wireResourceReferences) {
|
|
158
158
|
const d = ref.d;
|
|
159
159
|
const s = ref.s;
|
|
160
160
|
const p = ref.p;
|
|
@@ -180,8 +180,8 @@ var AppCallDataCodec = class extends require_codec.Codec {
|
|
|
180
180
|
const addrIdx = h.d ?? 0;
|
|
181
181
|
const assetIdx = h.s;
|
|
182
182
|
if (assetIdx === void 0) throw new Error("Access list holding reference is missing asset index");
|
|
183
|
-
const holdingAddress = addrIdx === 0 ? require_address.Address.zeroAddress() : require_address$1.addressCodec.decode(
|
|
184
|
-
const holdingAssetId =
|
|
183
|
+
const holdingAddress = addrIdx === 0 ? require_address.Address.zeroAddress() : require_address$1.addressCodec.decode(wireResourceReferences[addrIdx - 1].d, format);
|
|
184
|
+
const holdingAssetId = wireResourceReferences[assetIdx - 1].s;
|
|
185
185
|
result.push({ holding: {
|
|
186
186
|
assetId: require_bigint.bigIntCodec.decode(holdingAssetId, format),
|
|
187
187
|
address: holdingAddress
|
|
@@ -191,8 +191,8 @@ var AppCallDataCodec = class extends require_codec.Codec {
|
|
|
191
191
|
if (l) {
|
|
192
192
|
const addrIdx = l.d ?? 0;
|
|
193
193
|
const appIdx = l.p ?? 0;
|
|
194
|
-
const localsAddress = addrIdx === 0 ? require_address.Address.zeroAddress() : require_address$1.addressCodec.decode(
|
|
195
|
-
const localsAppId = appIdx === 0 ? 0n :
|
|
194
|
+
const localsAddress = addrIdx === 0 ? require_address.Address.zeroAddress() : require_address$1.addressCodec.decode(wireResourceReferences[addrIdx - 1].d, format);
|
|
195
|
+
const localsAppId = appIdx === 0 ? 0n : wireResourceReferences[appIdx - 1].p;
|
|
196
196
|
result.push({ locals: {
|
|
197
197
|
appId: require_bigint.bigIntCodec.decode(localsAppId, format),
|
|
198
198
|
address: localsAddress
|
|
@@ -203,7 +203,7 @@ var AppCallDataCodec = class extends require_codec.Codec {
|
|
|
203
203
|
const boxAppIdx = b.i ?? 0;
|
|
204
204
|
const name = b.n;
|
|
205
205
|
if (!name) throw new Error("Access list box reference is missing name");
|
|
206
|
-
const boxAppId = boxAppIdx === 0 ? 0n :
|
|
206
|
+
const boxAppId = boxAppIdx === 0 ? 0n : wireResourceReferences[boxAppIdx - 1].p;
|
|
207
207
|
result.push({ box: {
|
|
208
208
|
appId: require_bigint.bigIntCodec.decode(boxAppId, format),
|
|
209
209
|
name: require_bytes.bytesCodec.decode(name, format)
|
|
@@ -253,7 +253,7 @@ var AppCallDataCodec = class extends require_codec.Codec {
|
|
|
253
253
|
if (encodedParams && Object.keys(encodedParams).length > 0) Object.assign(result, encodedParams);
|
|
254
254
|
const wireBoxReferences = this.encodeBoxReferences(value.appId, value.appReferences, value.boxReferences, format);
|
|
255
255
|
if (wireBoxReferences) result.apbx = wireBoxReferences;
|
|
256
|
-
const wireAccessReferences = this.
|
|
256
|
+
const wireAccessReferences = this.encodeResourceReferences(value.appId, value.accessReferences, format);
|
|
257
257
|
if (wireAccessReferences) result.al = wireAccessReferences;
|
|
258
258
|
return result;
|
|
259
259
|
}
|
|
@@ -264,7 +264,7 @@ var AppCallDataCodec = class extends require_codec.Codec {
|
|
|
264
264
|
const wireBoxReferences = value.apbx;
|
|
265
265
|
const wireAccessReferences = value.al;
|
|
266
266
|
const boxReferences = this.decodeBoxReferences(appReferences?.map((ar) => require_bigint.bigIntCodec.decode(ar, format)), wireBoxReferences, format);
|
|
267
|
-
const accessReferences = this.
|
|
267
|
+
const accessReferences = this.decodeResourceReferences(wireAccessReferences, format);
|
|
268
268
|
return {
|
|
269
269
|
...this.appCallFieldsCodec.decode(value, format),
|
|
270
270
|
...accessReferences.length > 0 && { accessReferences },
|