@algorandfoundation/algokit-utils 7.0.0-beta.6 → 7.0.0-beta.8

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 (101) hide show
  1. package/app.d.ts +6 -6
  2. package/app.js +6 -6
  3. package/app.js.map +1 -1
  4. package/app.mjs +6 -6
  5. package/app.mjs.map +1 -1
  6. package/asset.d.ts +3 -3
  7. package/asset.js +3 -3
  8. package/asset.js.map +1 -1
  9. package/asset.mjs +3 -3
  10. package/asset.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/testing/fixtures/algorand-fixture.js +1 -1
  13. package/testing/fixtures/algorand-fixture.js.map +1 -1
  14. package/testing/fixtures/algorand-fixture.mjs +1 -1
  15. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  16. package/transaction/legacy-bridge.d.ts +3 -3
  17. package/transaction/legacy-bridge.js.map +1 -1
  18. package/transaction/legacy-bridge.mjs.map +1 -1
  19. package/transaction/transaction.d.ts +1 -3
  20. package/transaction/transaction.js +17 -11
  21. package/transaction/transaction.js.map +1 -1
  22. package/transaction/transaction.mjs +17 -11
  23. package/transaction/transaction.mjs.map +1 -1
  24. package/transfer/transfer-algos.d.ts +1 -1
  25. package/transfer/transfer-algos.js +1 -1
  26. package/transfer/transfer-algos.js.map +1 -1
  27. package/transfer/transfer-algos.mjs +1 -1
  28. package/transfer/transfer-algos.mjs.map +1 -1
  29. package/transfer/transfer.d.ts +1 -1
  30. package/transfer/transfer.js +1 -1
  31. package/transfer/transfer.js.map +1 -1
  32. package/transfer/transfer.mjs +1 -1
  33. package/transfer/transfer.mjs.map +1 -1
  34. package/types/account-manager.d.ts +13 -4
  35. package/types/account-manager.js +17 -3
  36. package/types/account-manager.js.map +1 -1
  37. package/types/account-manager.mjs +17 -3
  38. package/types/account-manager.mjs.map +1 -1
  39. package/types/algorand-client-interface.d.ts +1 -1
  40. package/types/algorand-client-transaction-creator.d.ts +30 -30
  41. package/types/algorand-client-transaction-creator.js +30 -30
  42. package/types/algorand-client-transaction-creator.js.map +1 -1
  43. package/types/algorand-client-transaction-creator.mjs +30 -30
  44. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  45. package/types/algorand-client-transaction-sender.d.ts +18 -18
  46. package/types/algorand-client-transaction-sender.js +1 -1
  47. package/types/algorand-client-transaction-sender.js.map +1 -1
  48. package/types/algorand-client-transaction-sender.mjs +1 -1
  49. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  50. package/types/algorand-client.d.ts +8 -8
  51. package/types/algorand-client.js +8 -8
  52. package/types/algorand-client.js.map +1 -1
  53. package/types/algorand-client.mjs +8 -8
  54. package/types/algorand-client.mjs.map +1 -1
  55. package/types/app-arc56.d.ts +60 -37
  56. package/types/app-arc56.js +37 -16
  57. package/types/app-arc56.js.map +1 -1
  58. package/types/app-arc56.mjs +37 -16
  59. package/types/app-arc56.mjs.map +1 -1
  60. package/types/app-client.d.ts +123 -132
  61. package/types/app-client.js +165 -94
  62. package/types/app-client.js.map +1 -1
  63. package/types/app-client.mjs +165 -94
  64. package/types/app-client.mjs.map +1 -1
  65. package/types/app-deployer.d.ts +2 -2
  66. package/types/app-deployer.js +24 -24
  67. package/types/app-deployer.js.map +1 -1
  68. package/types/app-deployer.mjs +24 -24
  69. package/types/app-deployer.mjs.map +1 -1
  70. package/types/app-factory.d.ts +116 -246
  71. package/types/app-factory.js +120 -39
  72. package/types/app-factory.js.map +1 -1
  73. package/types/app-factory.mjs +121 -40
  74. package/types/app-factory.mjs.map +1 -1
  75. package/types/app-spec.js +15 -9
  76. package/types/app-spec.js.map +1 -1
  77. package/types/app-spec.mjs +15 -9
  78. package/types/app-spec.mjs.map +1 -1
  79. package/types/app.d.ts +1 -1
  80. package/types/app.js.map +1 -1
  81. package/types/app.mjs.map +1 -1
  82. package/types/asset-manager.d.ts +3 -3
  83. package/types/asset-manager.js +2 -2
  84. package/types/asset-manager.js.map +1 -1
  85. package/types/asset-manager.mjs +2 -2
  86. package/types/asset-manager.mjs.map +1 -1
  87. package/types/client-manager.d.ts +30 -8
  88. package/types/client-manager.js +6 -0
  89. package/types/client-manager.js.map +1 -1
  90. package/types/client-manager.mjs +6 -0
  91. package/types/client-manager.mjs.map +1 -1
  92. package/types/composer.d.ts +29 -4
  93. package/types/composer.js +24 -7
  94. package/types/composer.js.map +1 -1
  95. package/types/composer.mjs +24 -7
  96. package/types/composer.mjs.map +1 -1
  97. package/types/kmd-account-manager.js +1 -1
  98. package/types/kmd-account-manager.js.map +1 -1
  99. package/types/kmd-account-manager.mjs +1 -1
  100. package/types/kmd-account-manager.mjs.map +1 -1
  101. package/types/transaction.d.ts +4 -6
package/app.d.ts CHANGED
@@ -8,8 +8,8 @@ import Algodv2 = algosdk.Algodv2;
8
8
  import modelsv2 = algosdk.modelsv2;
9
9
  import OnApplicationComplete = algosdk.OnApplicationComplete;
10
10
  /**
11
- * @deprecated Use `algorand.send.appCreate()` / `algorand.transactions.appCreate()` / `algorand.send.appCreateMethodCall()`
12
- * / `algorand.transactions.appCreateMethodCall()` instead
11
+ * @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`
12
+ * / `algorand.createTransaction.appCreateMethodCall()` instead
13
13
  *
14
14
  * Creates a smart contract app, returns the details of the created app.
15
15
  * @param create The parameters to create the app with
@@ -18,8 +18,8 @@ import OnApplicationComplete = algosdk.OnApplicationComplete;
18
18
  */
19
19
  export declare function createApp(create: CreateAppParams, algod: Algodv2): Promise<Partial<AppCompilationResult> & AppCallTransactionResult & AppReference>;
20
20
  /**
21
- * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()`
22
- * / `algorand.transactions.appUpdateMethodCall()` instead
21
+ * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
22
+ * / `algorand.createTransaction.appUpdateMethodCall()` instead
23
23
  *
24
24
  * Updates a smart contract app.
25
25
  * @param update The parameters to update the app with
@@ -41,8 +41,8 @@ export declare function updateApp(update: UpdateAppParams, algod: Algodv2): Prom
41
41
  */
42
42
  export declare function getAppOnCompleteAction(onCompletionAction?: AppCallType | OnApplicationComplete): algosdk.OnApplicationComplete;
43
43
  /**
44
- * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()`
45
- * / `algorand.transactions.appUpdateMethodCall()` instead
44
+ * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
45
+ * / `algorand.createTransaction.appUpdateMethodCall()` instead
46
46
  *
47
47
  * Issues a call to a given app.
48
48
  * @param call The call details.
package/app.js CHANGED
@@ -10,8 +10,8 @@ var ABIMethod = algosdk.ABIMethod;
10
10
  var modelsv2 = algosdk.modelsv2;
11
11
  var OnApplicationComplete = algosdk.OnApplicationComplete;
12
12
  /**
13
- * @deprecated Use `algorand.send.appCreate()` / `algorand.transactions.appCreate()` / `algorand.send.appCreateMethodCall()`
14
- * / `algorand.transactions.appCreateMethodCall()` instead
13
+ * @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`
14
+ * / `algorand.createTransaction.appCreateMethodCall()` instead
15
15
  *
16
16
  * Creates a smart contract app, returns the details of the created app.
17
17
  * @param create The parameters to create the app with
@@ -44,8 +44,8 @@ async function createApp(create, algod) {
44
44
  return { ...result, appId: 'appId' in result ? Number(result.appId) : 0, appAddress: 'appAddress' in result ? result.appAddress : '' };
45
45
  }
46
46
  /**
47
- * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()`
48
- * / `algorand.transactions.appUpdateMethodCall()` instead
47
+ * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
48
+ * / `algorand.createTransaction.appUpdateMethodCall()` instead
49
49
  *
50
50
  * Updates a smart contract app.
51
51
  * @param update The parameters to update the app with
@@ -106,8 +106,8 @@ function getAppOnCompleteAction(onCompletionAction) {
106
106
  }
107
107
  }
108
108
  /**
109
- * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()`
110
- * / `algorand.transactions.appUpdateMethodCall()` instead
109
+ * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
110
+ * / `algorand.createTransaction.appUpdateMethodCall()` instead
111
111
  *
112
112
  * Issues a call to a given app.
113
113
  * @param call The call details.
package/app.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sources":["../src/app.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { _getAppArgsForABICall, _getBoxReference, legacySendAppTransactionBridge } from './transaction/legacy-bridge'\nimport { encodeLease, getSenderAddress } from './transaction/transaction'\nimport {\n ABIAppCallArgs,\n ABIReturn,\n AppCallArgs,\n AppCallParams,\n AppCallTransactionResult,\n AppCallType,\n AppCompilationResult,\n AppReference,\n AppState,\n BoxIdentifier,\n BoxName,\n BoxReference,\n BoxValueRequestParams,\n BoxValuesRequestParams,\n CompiledTeal,\n CreateAppParams,\n RawAppCallArgs,\n UpdateAppParams,\n} from './types/app'\nimport { AppManager } from './types/app-manager'\nimport { SendTransactionFrom } from './types/transaction'\nimport { toNumber } from './util'\nimport ABIMethod = algosdk.ABIMethod\nimport ABIMethodParams = algosdk.ABIMethodParams\nimport ABIValue = algosdk.ABIValue\nimport Address = algosdk.Address\nimport Algodv2 = algosdk.Algodv2\nimport modelsv2 = algosdk.modelsv2\nimport OnApplicationComplete = algosdk.OnApplicationComplete\n\n/**\n * @deprecated Use `algorand.send.appCreate()` / `algorand.transactions.appCreate()` / `algorand.send.appCreateMethodCall()`\n * / `algorand.transactions.appCreateMethodCall()` instead\n *\n * Creates a smart contract app, returns the details of the created app.\n * @param create The parameters to create the app with\n * @param algod An algod client\n * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result\n */\nexport async function createApp(\n create: CreateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult & AppReference> {\n const onComplete = getAppOnCompleteAction(create.onCompleteAction)\n if (onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot create an app with on-complete action of ClearState')\n }\n\n const result = create.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method),\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreateMethodCall,\n (c) => c.appCreateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreate,\n (c) => c.appCreate,\n )\n\n return { ...result, appId: 'appId' in result ? Number(result.appId) : 0, appAddress: 'appAddress' in result ? result.appAddress : '' }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.transactions.appUpdateMethodCall()` instead\n *\n * Updates a smart contract app.\n * @param update The parameters to update the app with\n * @param algod An algod client\n * @returns The transaction send result and the compilation result\n */\nexport async function updateApp(\n update: UpdateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult> {\n return update.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method),\n },\n (c) => c.appUpdateMethodCall,\n (c) => c.appUpdateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n },\n (c) => c.appUpdate,\n (c) => c.appUpdate,\n )\n}\n\n/**\n * @deprecated Use `algosdk.OnApplicationComplete` directly instead.\n *\n * Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction.\n *\n * If given `undefined` will return `OnApplicationComplete.NoOpOC`.\n *\n * If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`.\n *\n * @param onCompletionAction The on completion action\n * @returns The `algosdk.OnApplicationComplete`\n */\nexport function getAppOnCompleteAction(onCompletionAction?: AppCallType | OnApplicationComplete) {\n switch (onCompletionAction) {\n case undefined:\n case 'no_op':\n case OnApplicationComplete.NoOpOC:\n return OnApplicationComplete.NoOpOC\n case 'opt_in':\n case OnApplicationComplete.OptInOC:\n return OnApplicationComplete.OptInOC\n case 'close_out':\n case OnApplicationComplete.CloseOutOC:\n return OnApplicationComplete.CloseOutOC\n case 'clear_state':\n case OnApplicationComplete.ClearStateOC:\n return OnApplicationComplete.ClearStateOC\n case 'update_application':\n case OnApplicationComplete.UpdateApplicationOC:\n return OnApplicationComplete.UpdateApplicationOC\n case 'delete_application':\n case OnApplicationComplete.DeleteApplicationOC:\n return OnApplicationComplete.DeleteApplicationOC\n }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.transactions.appUpdateMethodCall()` instead\n *\n * Issues a call to a given app.\n * @param call The call details.\n * @param algod An algod client\n * @returns The result of the call\n */\nexport async function callApp(call: AppCallParams, algod: Algodv2): Promise<AppCallTransactionResult> {\n const onComplete = getAppOnCompleteAction(call.callType)\n if (onComplete === algosdk.OnApplicationComplete.UpdateApplicationOC) {\n throw new Error('Cannot execute an app call with on-complete action of Update')\n }\n if (call.args?.method && onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot execute an ABI method call with on-complete action of ClearState')\n }\n\n return call.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onComplete: onComplete as any,\n method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method),\n },\n (c) => c.appCallMethodCall,\n (c) => c.appCallMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n onComplete,\n },\n (c) => c.appCall,\n (c) => c.appCall,\n )\n}\n\n/**\n * @deprecated Use `AppManager.getABIReturn` instead.\n *\n * Returns any ABI return values for the given app call arguments and transaction confirmation.\n * @param args The arguments that were used for the call\n * @param confirmation The transaction confirmation from algod\n * @returns The return value for the method call\n */\nexport function getABIReturn(args?: AppCallArgs, confirmation?: modelsv2.PendingTransactionResponse): ABIReturn | undefined {\n if (!args || !args.method) {\n return undefined\n }\n const method = 'txnCount' in args.method ? args.method : new ABIMethod(args.method)\n\n return AppManager.getABIReturn(confirmation, method)\n}\n\n/**\n * @deprecated Use `algorand.app.getGlobalState` instead.\n *\n * Returns the current global state values for the given app ID\n * @param appId The ID of the app return global state for\n * @param algod An algod client instance\n * @returns The current global state\n */\nexport async function getAppGlobalState(appId: number | bigint, algod: Algodv2) {\n return await new AppManager(algod).getGlobalState(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getLocalState` instead.\n *\n * Returns the current global state values for the given app ID and account\n * @param appId The ID of the app return global state for\n * @param account Either the string address of an account or an account object for the account to get local state for the given app\n * @param algod An algod client instance\n * @returns The current local state for the given (app, account) combination\n */\nexport async function getAppLocalState(appId: number | bigint, account: string | SendTransactionFrom, algod: Algodv2) {\n return new AppManager(algod).getLocalState(BigInt(appId), getSenderAddress(account))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxNames` instead.\n * Returns the names of the boxes for the given app.\n * @param appId The ID of the app return box names for\n * @param algod An algod client instance\n * @returns The current box names\n */\nexport async function getAppBoxNames(appId: number | bigint, algod: Algodv2): Promise<BoxName[]> {\n return new AppManager(algod).getBoxNames(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValue` instead.\n * Returns the value of the given box name for the given app.\n * @param appId The ID of the app return box names for\n * @param boxName The name of the box to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box value as a byte array\n */\nexport async function getAppBoxValue(appId: number | bigint, boxName: string | Uint8Array | BoxName, algod: Algodv2): Promise<Uint8Array> {\n return new AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== 'string' && 'name' in boxName ? boxName.nameRaw : boxName)\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValues` instead.\n * Returns the value of the given box names for the given app.\n * @param appId The ID of the app return box names for\n * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box values as a byte array in the same order as the passed in box names\n */\nexport async function getAppBoxValues(appId: number, boxNames: (string | Uint8Array | BoxName)[], algod: Algodv2): Promise<Uint8Array[]> {\n return new AppManager(algod).getBoxValues(\n BigInt(appId),\n boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n )\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValueFromABIType` instead.\n * Returns the value of the given box name for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box value as an ABI value\n */\nexport async function getAppBoxValueFromABIType(request: BoxValueRequestParams, algod: Algodv2): Promise<ABIValue> {\n return new AppManager(algod).getBoxValueFromABIType({\n appId: BigInt(request.appId),\n boxName: typeof request.boxName !== 'string' && 'name' in request.boxName ? request.boxName.nameRaw : request.boxName,\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValuesFromABIType` instead.\n * Returns the value of the given box names for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box values as an ABI value in the same order as the passed in box names\n */\nexport async function getAppBoxValuesFromABIType(request: BoxValuesRequestParams, algod: Algodv2): Promise<ABIValue[]> {\n return new AppManager(algod).getBoxValuesFromABIType({\n appId: BigInt(request.appId),\n boxNames: request.boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `AppManager.decodeAppState` instead.\n *\n * Converts an array of global/local state values from the algod api to a more friendly\n * generic object keyed by the UTF-8 value of the key.\n * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`\n * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values\n */\nexport function decodeAppState(state: { key: string; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState {\n return AppManager.decodeAppState(state)\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an app `Transaction` object\n * @param args The app call args\n * @returns The args ready to load into a `Transaction`\n */\nexport function getAppArgsForTransaction(args?: RawAppCallArgs) {\n if (!args) return undefined\n\n const encoder = new TextEncoder()\n return {\n accounts: args?.accounts?.map(_getAccountAddress),\n appArgs: args?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)),\n boxes: args.boxes?.map(getBoxReference),\n foreignApps: args?.apps,\n foreignAssets: args?.assets,\n lease: encodeLease(args?.lease),\n }\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`\n * @param args The ABI app call args\n * @param from The transaction signer\n * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer\n */\nexport async function getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n return _getAppArgsForABICall(args, from)\n}\n\n/**\n * @deprecated Use `AppManager.getBoxReference()` instead.\n *\n * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.\n * @param box The box to return a reference for\n * @returns The box reference ready to pass into a `Transaction`\n */\nexport function getBoxReference(box: BoxIdentifier | BoxReference | algosdk.BoxReference): algosdk.BoxReference {\n return _getBoxReference(box)\n}\n\nfunction _getAccountAddress(account: string | Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/**\n * @deprecated Use `algorand.app.getById` instead.\n *\n * Gets the current data for the given app from algod.\n *\n * @param appId The id of the app\n * @param algod An algod client\n * @returns The data about the app\n */\nexport async function getAppById(appId: number | bigint, algod: Algodv2) {\n return modelsv2.Application.from_obj_for_encoding(await algod.getApplicationByID(toNumber(appId)).do())\n}\n\n/**\n * @deprecated Use `algorand.app.compileTeal` instead.\n *\n * Compiles the given TEAL using algod and returns the result, including source map.\n *\n * @param algod An algod client\n * @param tealCode The TEAL code\n * @returns The information about the compiled file\n */\nexport async function compileTeal(tealCode: string, algod: Algodv2): Promise<CompiledTeal> {\n return await new AppManager(algod).compileTeal(tealCode)\n}\n\n/**\n * @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead.\n *\n * Returns the encoded ABI spec for a given ABI Method\n * @param method The method to return a signature for\n * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`\n */\nexport const getABIMethodSignature = (method: ABIMethodParams | ABIMethod) => {\n return 'getSignature' in method ? method.getSignature() : new ABIMethod(method).getSignature()\n}\n"],"names":["legacySendAppTransactionBridge","getSenderAddress","AppManager","encodeLease","_getAppArgsForABICall","_getBoxReference","toNumber"],"mappings":";;;;;;;;AA0BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;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ACnD,IAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACzF,CAAC;AAED;;;;;;;;AAQG;AACI,eAAe,UAAU,CAAC,KAAsB,EAAE,KAAc,EAAA;IACrE,OAAO,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,MAAM,KAAK,CAAC,kBAAkB,CAACC,aAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AACzG,CAAC;AAED;;;;;;;;AAQG;AACI,eAAe,WAAW,CAAC,QAAgB,EAAE,KAAc,EAAA;IAChE,OAAO,MAAM,IAAIJ,2BAAU,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;AAC1D,CAAC;AAED;;;;;;AAMG;AACU,MAAA,qBAAqB,GAAG,CAAC,MAAmC,KAAI;IAC3E,OAAO,cAAc,IAAI,MAAM,GAAG,MAAM,CAAC,YAAY,EAAE,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,CAAA;AAChG;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"app.js","sources":["../src/app.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { _getAppArgsForABICall, _getBoxReference, legacySendAppTransactionBridge } from './transaction/legacy-bridge'\nimport { encodeLease, getSenderAddress } from './transaction/transaction'\nimport {\n ABIAppCallArgs,\n ABIReturn,\n AppCallArgs,\n AppCallParams,\n AppCallTransactionResult,\n AppCallType,\n AppCompilationResult,\n AppReference,\n AppState,\n BoxIdentifier,\n BoxName,\n BoxReference,\n BoxValueRequestParams,\n BoxValuesRequestParams,\n CompiledTeal,\n CreateAppParams,\n RawAppCallArgs,\n UpdateAppParams,\n} from './types/app'\nimport { AppManager } from './types/app-manager'\nimport { SendTransactionFrom } from './types/transaction'\nimport { toNumber } from './util'\nimport ABIMethod = algosdk.ABIMethod\nimport ABIMethodParams = algosdk.ABIMethodParams\nimport ABIValue = algosdk.ABIValue\nimport Address = algosdk.Address\nimport Algodv2 = algosdk.Algodv2\nimport modelsv2 = algosdk.modelsv2\nimport OnApplicationComplete = algosdk.OnApplicationComplete\n\n/**\n * @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`\n * / `algorand.createTransaction.appCreateMethodCall()` instead\n *\n * Creates a smart contract app, returns the details of the created app.\n * @param create The parameters to create the app with\n * @param algod An algod client\n * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result\n */\nexport async function createApp(\n create: CreateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult & AppReference> {\n const onComplete = getAppOnCompleteAction(create.onCompleteAction)\n if (onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot create an app with on-complete action of ClearState')\n }\n\n const result = create.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method),\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreateMethodCall,\n (c) => c.appCreateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreate,\n (c) => c.appCreate,\n )\n\n return { ...result, appId: 'appId' in result ? Number(result.appId) : 0, appAddress: 'appAddress' in result ? result.appAddress : '' }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Updates a smart contract app.\n * @param update The parameters to update the app with\n * @param algod An algod client\n * @returns The transaction send result and the compilation result\n */\nexport async function updateApp(\n update: UpdateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult> {\n return update.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method),\n },\n (c) => c.appUpdateMethodCall,\n (c) => c.appUpdateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n },\n (c) => c.appUpdate,\n (c) => c.appUpdate,\n )\n}\n\n/**\n * @deprecated Use `algosdk.OnApplicationComplete` directly instead.\n *\n * Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction.\n *\n * If given `undefined` will return `OnApplicationComplete.NoOpOC`.\n *\n * If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`.\n *\n * @param onCompletionAction The on completion action\n * @returns The `algosdk.OnApplicationComplete`\n */\nexport function getAppOnCompleteAction(onCompletionAction?: AppCallType | OnApplicationComplete) {\n switch (onCompletionAction) {\n case undefined:\n case 'no_op':\n case OnApplicationComplete.NoOpOC:\n return OnApplicationComplete.NoOpOC\n case 'opt_in':\n case OnApplicationComplete.OptInOC:\n return OnApplicationComplete.OptInOC\n case 'close_out':\n case OnApplicationComplete.CloseOutOC:\n return OnApplicationComplete.CloseOutOC\n case 'clear_state':\n case OnApplicationComplete.ClearStateOC:\n return OnApplicationComplete.ClearStateOC\n case 'update_application':\n case OnApplicationComplete.UpdateApplicationOC:\n return OnApplicationComplete.UpdateApplicationOC\n case 'delete_application':\n case OnApplicationComplete.DeleteApplicationOC:\n return OnApplicationComplete.DeleteApplicationOC\n }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Issues a call to a given app.\n * @param call The call details.\n * @param algod An algod client\n * @returns The result of the call\n */\nexport async function callApp(call: AppCallParams, algod: Algodv2): Promise<AppCallTransactionResult> {\n const onComplete = getAppOnCompleteAction(call.callType)\n if (onComplete === algosdk.OnApplicationComplete.UpdateApplicationOC) {\n throw new Error('Cannot execute an app call with on-complete action of Update')\n }\n if (call.args?.method && onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot execute an ABI method call with on-complete action of ClearState')\n }\n\n return call.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onComplete: onComplete as any,\n method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method),\n },\n (c) => c.appCallMethodCall,\n (c) => c.appCallMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n onComplete,\n },\n (c) => c.appCall,\n (c) => c.appCall,\n )\n}\n\n/**\n * @deprecated Use `AppManager.getABIReturn` instead.\n *\n * Returns any ABI return values for the given app call arguments and transaction confirmation.\n * @param args The arguments that were used for the call\n * @param confirmation The transaction confirmation from algod\n * @returns The return value for the method call\n */\nexport function getABIReturn(args?: AppCallArgs, confirmation?: modelsv2.PendingTransactionResponse): ABIReturn | undefined {\n if (!args || !args.method) {\n return undefined\n }\n const method = 'txnCount' in args.method ? args.method : new ABIMethod(args.method)\n\n return AppManager.getABIReturn(confirmation, method)\n}\n\n/**\n * @deprecated Use `algorand.app.getGlobalState` instead.\n *\n * Returns the current global state values for the given app ID\n * @param appId The ID of the app return global state for\n * @param algod An algod client instance\n * @returns The current global state\n */\nexport async function getAppGlobalState(appId: number | bigint, algod: Algodv2) {\n return await new AppManager(algod).getGlobalState(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getLocalState` instead.\n *\n * Returns the current global state values for the given app ID and account\n * @param appId The ID of the app return global state for\n * @param account Either the string address of an account or an account object for the account to get local state for the given app\n * @param algod An algod client instance\n * @returns The current local state for the given (app, account) combination\n */\nexport async function getAppLocalState(appId: number | bigint, account: string | SendTransactionFrom, algod: Algodv2) {\n return new AppManager(algod).getLocalState(BigInt(appId), getSenderAddress(account))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxNames` instead.\n * Returns the names of the boxes for the given app.\n * @param appId The ID of the app return box names for\n * @param algod An algod client instance\n * @returns The current box names\n */\nexport async function getAppBoxNames(appId: number | bigint, algod: Algodv2): Promise<BoxName[]> {\n return new AppManager(algod).getBoxNames(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValue` instead.\n * Returns the value of the given box name for the given app.\n * @param appId The ID of the app return box names for\n * @param boxName The name of the box to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box value as a byte array\n */\nexport async function getAppBoxValue(appId: number | bigint, boxName: string | Uint8Array | BoxName, algod: Algodv2): Promise<Uint8Array> {\n return new AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== 'string' && 'name' in boxName ? boxName.nameRaw : boxName)\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValues` instead.\n * Returns the value of the given box names for the given app.\n * @param appId The ID of the app return box names for\n * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box values as a byte array in the same order as the passed in box names\n */\nexport async function getAppBoxValues(appId: number, boxNames: (string | Uint8Array | BoxName)[], algod: Algodv2): Promise<Uint8Array[]> {\n return new AppManager(algod).getBoxValues(\n BigInt(appId),\n boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n )\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValueFromABIType` instead.\n * Returns the value of the given box name for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box value as an ABI value\n */\nexport async function getAppBoxValueFromABIType(request: BoxValueRequestParams, algod: Algodv2): Promise<ABIValue> {\n return new AppManager(algod).getBoxValueFromABIType({\n appId: BigInt(request.appId),\n boxName: typeof request.boxName !== 'string' && 'name' in request.boxName ? request.boxName.nameRaw : request.boxName,\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValuesFromABIType` instead.\n * Returns the value of the given box names for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box values as an ABI value in the same order as the passed in box names\n */\nexport async function getAppBoxValuesFromABIType(request: BoxValuesRequestParams, algod: Algodv2): Promise<ABIValue[]> {\n return new AppManager(algod).getBoxValuesFromABIType({\n appId: BigInt(request.appId),\n boxNames: request.boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `AppManager.decodeAppState` instead.\n *\n * Converts an array of global/local state values from the algod api to a more friendly\n * generic object keyed by the UTF-8 value of the key.\n * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`\n * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values\n */\nexport function decodeAppState(state: { key: string; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState {\n return AppManager.decodeAppState(state)\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an app `Transaction` object\n * @param args The app call args\n * @returns The args ready to load into a `Transaction`\n */\nexport function getAppArgsForTransaction(args?: RawAppCallArgs) {\n if (!args) return undefined\n\n const encoder = new TextEncoder()\n return {\n accounts: args?.accounts?.map(_getAccountAddress),\n appArgs: args?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)),\n boxes: args.boxes?.map(getBoxReference),\n foreignApps: args?.apps,\n foreignAssets: args?.assets,\n lease: encodeLease(args?.lease),\n }\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`\n * @param args The ABI app call args\n * @param from The transaction signer\n * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer\n */\nexport async function getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n return _getAppArgsForABICall(args, from)\n}\n\n/**\n * @deprecated Use `AppManager.getBoxReference()` instead.\n *\n * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.\n * @param box The box to return a reference for\n * @returns The box reference ready to pass into a `Transaction`\n */\nexport function getBoxReference(box: BoxIdentifier | BoxReference | algosdk.BoxReference): algosdk.BoxReference {\n return _getBoxReference(box)\n}\n\nfunction _getAccountAddress(account: string | Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/**\n * @deprecated Use `algorand.app.getById` instead.\n *\n * Gets the current data for the given app from algod.\n *\n * @param appId The id of the app\n * @param algod An algod client\n * @returns The data about the app\n */\nexport async function getAppById(appId: number | bigint, algod: Algodv2) {\n return modelsv2.Application.from_obj_for_encoding(await algod.getApplicationByID(toNumber(appId)).do())\n}\n\n/**\n * @deprecated Use `algorand.app.compileTeal` instead.\n *\n * Compiles the given TEAL using algod and returns the result, including source map.\n *\n * @param algod An algod client\n * @param tealCode The TEAL code\n * @returns The information about the compiled file\n */\nexport async function compileTeal(tealCode: string, algod: Algodv2): Promise<CompiledTeal> {\n return await new AppManager(algod).compileTeal(tealCode)\n}\n\n/**\n * @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead.\n *\n * Returns the encoded ABI spec for a given ABI Method\n * @param method The method to return a signature for\n * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`\n */\nexport const getABIMethodSignature = (method: ABIMethodParams | ABIMethod) => {\n return 'getSignature' in method ? method.getSignature() : new ABIMethod(method).getSignature()\n}\n"],"names":["legacySendAppTransactionBridge","getSenderAddress","AppManager","encodeLease","_getAppArgsForABICall","_getBoxReference","toNumber"],"mappings":";;;;;;;;AA0BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAKpC,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAClC,IAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAA;AAE5D;;;;;;;;AAQG;AACI,eAAe,SAAS,CAC7B,MAAuB,EACvB,KAAc,EAAA;IAEd,MAAM,UAAU,GAAG,sBAAsB,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;IAClE,IAAI,UAAU,KAAK,OAAO,CAAC,qBAAqB,CAAC,YAAY,EAAE;AAC7D,QAAA,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAA;KAC9E;AAED,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM;AAChC,UAAE,MAAMA,2CAA8B,CAClC,KAAK,EACL,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,IAAI,EACX,MAAM,EACN;AACE,YAAA,MAAM,EAAEC,4BAAgB,CAAC,MAAM,CAAC,IAAI,CAAC;YACrC,UAAU;YACV,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;YAC3C,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,YAAY,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;AACxG,YAAA,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;YAC3C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KAChC,CAAA;AACH,CAAC;AAED;;;;;;;AAOG;AACI,eAAe,oBAAoB,CAAC,IAAoB,EAAE,IAAyB,EAAA;AACxF,IAAA,OAAOC,kCAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AAC1C,CAAC;AAED;;;;;;AAMG;AACG,SAAU,eAAe,CAAC,GAAwD,EAAA;AACtF,IAAA,OAAOC,6BAAgB,CAAC,GAAG,CAAC,CAAA;AAC9B,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAyB,EAAA;AACnD,IAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACzF,CAAC;AAED;;;;;;;;AAQG;AACI,eAAe,UAAU,CAAC,KAAsB,EAAE,KAAc,EAAA;IACrE,OAAO,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,MAAM,KAAK,CAAC,kBAAkB,CAACC,aAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AACzG,CAAC;AAED;;;;;;;;AAQG;AACI,eAAe,WAAW,CAAC,QAAgB,EAAE,KAAc,EAAA;IAChE,OAAO,MAAM,IAAIJ,2BAAU,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;AAC1D,CAAC;AAED;;;;;;AAMG;AACU,MAAA,qBAAqB,GAAG,CAAC,MAAmC,KAAI;IAC3E,OAAO,cAAc,IAAI,MAAM,GAAG,MAAM,CAAC,YAAY,EAAE,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,CAAA;AAChG;;;;;;;;;;;;;;;;;;;;;;"}
package/app.mjs CHANGED
@@ -8,8 +8,8 @@ var ABIMethod = algosdk.ABIMethod;
8
8
  var modelsv2 = algosdk.modelsv2;
9
9
  var OnApplicationComplete = algosdk.OnApplicationComplete;
10
10
  /**
11
- * @deprecated Use `algorand.send.appCreate()` / `algorand.transactions.appCreate()` / `algorand.send.appCreateMethodCall()`
12
- * / `algorand.transactions.appCreateMethodCall()` instead
11
+ * @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`
12
+ * / `algorand.createTransaction.appCreateMethodCall()` instead
13
13
  *
14
14
  * Creates a smart contract app, returns the details of the created app.
15
15
  * @param create The parameters to create the app with
@@ -42,8 +42,8 @@ async function createApp(create, algod) {
42
42
  return { ...result, appId: 'appId' in result ? Number(result.appId) : 0, appAddress: 'appAddress' in result ? result.appAddress : '' };
43
43
  }
44
44
  /**
45
- * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()`
46
- * / `algorand.transactions.appUpdateMethodCall()` instead
45
+ * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
46
+ * / `algorand.createTransaction.appUpdateMethodCall()` instead
47
47
  *
48
48
  * Updates a smart contract app.
49
49
  * @param update The parameters to update the app with
@@ -104,8 +104,8 @@ function getAppOnCompleteAction(onCompletionAction) {
104
104
  }
105
105
  }
106
106
  /**
107
- * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()`
108
- * / `algorand.transactions.appUpdateMethodCall()` instead
107
+ * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
108
+ * / `algorand.createTransaction.appUpdateMethodCall()` instead
109
109
  *
110
110
  * Issues a call to a given app.
111
111
  * @param call The call details.
package/app.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.mjs","sources":["../src/app.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { _getAppArgsForABICall, _getBoxReference, legacySendAppTransactionBridge } from './transaction/legacy-bridge'\nimport { encodeLease, getSenderAddress } from './transaction/transaction'\nimport {\n ABIAppCallArgs,\n ABIReturn,\n AppCallArgs,\n AppCallParams,\n AppCallTransactionResult,\n AppCallType,\n AppCompilationResult,\n AppReference,\n AppState,\n BoxIdentifier,\n BoxName,\n BoxReference,\n BoxValueRequestParams,\n BoxValuesRequestParams,\n CompiledTeal,\n CreateAppParams,\n RawAppCallArgs,\n UpdateAppParams,\n} from './types/app'\nimport { AppManager } from './types/app-manager'\nimport { SendTransactionFrom } from './types/transaction'\nimport { toNumber } from './util'\nimport ABIMethod = algosdk.ABIMethod\nimport ABIMethodParams = algosdk.ABIMethodParams\nimport ABIValue = algosdk.ABIValue\nimport Address = algosdk.Address\nimport Algodv2 = algosdk.Algodv2\nimport modelsv2 = algosdk.modelsv2\nimport OnApplicationComplete = algosdk.OnApplicationComplete\n\n/**\n * @deprecated Use `algorand.send.appCreate()` / `algorand.transactions.appCreate()` / `algorand.send.appCreateMethodCall()`\n * / `algorand.transactions.appCreateMethodCall()` instead\n *\n * Creates a smart contract app, returns the details of the created app.\n * @param create The parameters to create the app with\n * @param algod An algod client\n * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result\n */\nexport async function createApp(\n create: CreateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult & AppReference> {\n const onComplete = getAppOnCompleteAction(create.onCompleteAction)\n if (onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot create an app with on-complete action of ClearState')\n }\n\n const result = create.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method),\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreateMethodCall,\n (c) => c.appCreateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreate,\n (c) => c.appCreate,\n )\n\n return { ...result, appId: 'appId' in result ? Number(result.appId) : 0, appAddress: 'appAddress' in result ? result.appAddress : '' }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.transactions.appUpdateMethodCall()` instead\n *\n * Updates a smart contract app.\n * @param update The parameters to update the app with\n * @param algod An algod client\n * @returns The transaction send result and the compilation result\n */\nexport async function updateApp(\n update: UpdateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult> {\n return update.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method),\n },\n (c) => c.appUpdateMethodCall,\n (c) => c.appUpdateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n },\n (c) => c.appUpdate,\n (c) => c.appUpdate,\n )\n}\n\n/**\n * @deprecated Use `algosdk.OnApplicationComplete` directly instead.\n *\n * Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction.\n *\n * If given `undefined` will return `OnApplicationComplete.NoOpOC`.\n *\n * If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`.\n *\n * @param onCompletionAction The on completion action\n * @returns The `algosdk.OnApplicationComplete`\n */\nexport function getAppOnCompleteAction(onCompletionAction?: AppCallType | OnApplicationComplete) {\n switch (onCompletionAction) {\n case undefined:\n case 'no_op':\n case OnApplicationComplete.NoOpOC:\n return OnApplicationComplete.NoOpOC\n case 'opt_in':\n case OnApplicationComplete.OptInOC:\n return OnApplicationComplete.OptInOC\n case 'close_out':\n case OnApplicationComplete.CloseOutOC:\n return OnApplicationComplete.CloseOutOC\n case 'clear_state':\n case OnApplicationComplete.ClearStateOC:\n return OnApplicationComplete.ClearStateOC\n case 'update_application':\n case OnApplicationComplete.UpdateApplicationOC:\n return OnApplicationComplete.UpdateApplicationOC\n case 'delete_application':\n case OnApplicationComplete.DeleteApplicationOC:\n return OnApplicationComplete.DeleteApplicationOC\n }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.transactions.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.transactions.appUpdateMethodCall()` instead\n *\n * Issues a call to a given app.\n * @param call The call details.\n * @param algod An algod client\n * @returns The result of the call\n */\nexport async function callApp(call: AppCallParams, algod: Algodv2): Promise<AppCallTransactionResult> {\n const onComplete = getAppOnCompleteAction(call.callType)\n if (onComplete === algosdk.OnApplicationComplete.UpdateApplicationOC) {\n throw new Error('Cannot execute an app call with on-complete action of Update')\n }\n if (call.args?.method && onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot execute an ABI method call with on-complete action of ClearState')\n }\n\n return call.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onComplete: onComplete as any,\n method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method),\n },\n (c) => c.appCallMethodCall,\n (c) => c.appCallMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n onComplete,\n },\n (c) => c.appCall,\n (c) => c.appCall,\n )\n}\n\n/**\n * @deprecated Use `AppManager.getABIReturn` instead.\n *\n * Returns any ABI return values for the given app call arguments and transaction confirmation.\n * @param args The arguments that were used for the call\n * @param confirmation The transaction confirmation from algod\n * @returns The return value for the method call\n */\nexport function getABIReturn(args?: AppCallArgs, confirmation?: modelsv2.PendingTransactionResponse): ABIReturn | undefined {\n if (!args || !args.method) {\n return undefined\n }\n const method = 'txnCount' in args.method ? args.method : new ABIMethod(args.method)\n\n return AppManager.getABIReturn(confirmation, method)\n}\n\n/**\n * @deprecated Use `algorand.app.getGlobalState` instead.\n *\n * Returns the current global state values for the given app ID\n * @param appId The ID of the app return global state for\n * @param algod An algod client instance\n * @returns The current global state\n */\nexport async function getAppGlobalState(appId: number | bigint, algod: Algodv2) {\n return await new AppManager(algod).getGlobalState(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getLocalState` instead.\n *\n * Returns the current global state values for the given app ID and account\n * @param appId The ID of the app return global state for\n * @param account Either the string address of an account or an account object for the account to get local state for the given app\n * @param algod An algod client instance\n * @returns The current local state for the given (app, account) combination\n */\nexport async function getAppLocalState(appId: number | bigint, account: string | SendTransactionFrom, algod: Algodv2) {\n return new AppManager(algod).getLocalState(BigInt(appId), getSenderAddress(account))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxNames` instead.\n * Returns the names of the boxes for the given app.\n * @param appId The ID of the app return box names for\n * @param algod An algod client instance\n * @returns The current box names\n */\nexport async function getAppBoxNames(appId: number | bigint, algod: Algodv2): Promise<BoxName[]> {\n return new AppManager(algod).getBoxNames(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValue` instead.\n * Returns the value of the given box name for the given app.\n * @param appId The ID of the app return box names for\n * @param boxName The name of the box to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box value as a byte array\n */\nexport async function getAppBoxValue(appId: number | bigint, boxName: string | Uint8Array | BoxName, algod: Algodv2): Promise<Uint8Array> {\n return new AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== 'string' && 'name' in boxName ? boxName.nameRaw : boxName)\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValues` instead.\n * Returns the value of the given box names for the given app.\n * @param appId The ID of the app return box names for\n * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box values as a byte array in the same order as the passed in box names\n */\nexport async function getAppBoxValues(appId: number, boxNames: (string | Uint8Array | BoxName)[], algod: Algodv2): Promise<Uint8Array[]> {\n return new AppManager(algod).getBoxValues(\n BigInt(appId),\n boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n )\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValueFromABIType` instead.\n * Returns the value of the given box name for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box value as an ABI value\n */\nexport async function getAppBoxValueFromABIType(request: BoxValueRequestParams, algod: Algodv2): Promise<ABIValue> {\n return new AppManager(algod).getBoxValueFromABIType({\n appId: BigInt(request.appId),\n boxName: typeof request.boxName !== 'string' && 'name' in request.boxName ? request.boxName.nameRaw : request.boxName,\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValuesFromABIType` instead.\n * Returns the value of the given box names for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box values as an ABI value in the same order as the passed in box names\n */\nexport async function getAppBoxValuesFromABIType(request: BoxValuesRequestParams, algod: Algodv2): Promise<ABIValue[]> {\n return new AppManager(algod).getBoxValuesFromABIType({\n appId: BigInt(request.appId),\n boxNames: request.boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `AppManager.decodeAppState` instead.\n *\n * Converts an array of global/local state values from the algod api to a more friendly\n * generic object keyed by the UTF-8 value of the key.\n * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`\n * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values\n */\nexport function decodeAppState(state: { key: string; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState {\n return AppManager.decodeAppState(state)\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an app `Transaction` object\n * @param args The app call args\n * @returns The args ready to load into a `Transaction`\n */\nexport function getAppArgsForTransaction(args?: RawAppCallArgs) {\n if (!args) return undefined\n\n const encoder = new TextEncoder()\n return {\n accounts: args?.accounts?.map(_getAccountAddress),\n appArgs: args?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)),\n boxes: args.boxes?.map(getBoxReference),\n foreignApps: args?.apps,\n foreignAssets: args?.assets,\n lease: encodeLease(args?.lease),\n }\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`\n * @param args The ABI app call args\n * @param from The transaction signer\n * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer\n */\nexport async function getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n return _getAppArgsForABICall(args, from)\n}\n\n/**\n * @deprecated Use `AppManager.getBoxReference()` instead.\n *\n * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.\n * @param box The box to return a reference for\n * @returns The box reference ready to pass into a `Transaction`\n */\nexport function getBoxReference(box: BoxIdentifier | BoxReference | algosdk.BoxReference): algosdk.BoxReference {\n return _getBoxReference(box)\n}\n\nfunction _getAccountAddress(account: string | Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/**\n * @deprecated Use `algorand.app.getById` instead.\n *\n * Gets the current data for the given app from algod.\n *\n * @param appId The id of the app\n * @param algod An algod client\n * @returns The data about the app\n */\nexport async function getAppById(appId: number | bigint, algod: Algodv2) {\n return modelsv2.Application.from_obj_for_encoding(await algod.getApplicationByID(toNumber(appId)).do())\n}\n\n/**\n * @deprecated Use `algorand.app.compileTeal` instead.\n *\n * Compiles the given TEAL using algod and returns the result, including source map.\n *\n * @param algod An algod client\n * @param tealCode The TEAL code\n * @returns The information about the compiled file\n */\nexport async function compileTeal(tealCode: string, algod: Algodv2): Promise<CompiledTeal> {\n return await new AppManager(algod).compileTeal(tealCode)\n}\n\n/**\n * @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead.\n *\n * Returns the encoded ABI spec for a given ABI Method\n * @param method The method to return a signature for\n * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`\n */\nexport const getABIMethodSignature = (method: ABIMethodParams | ABIMethod) => {\n return 'getSignature' in method ? method.getSignature() : new ABIMethod(method).getSignature()\n}\n"],"names":[],"mappings":";;;;;;AA0BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAKpC,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAClC,IAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAA;AAE5D;;;;;;;;AAQG;AACI,eAAe,SAAS,CAC7B,MAAuB,EACvB,KAAc,EAAA;IAEd,MAAM,UAAU,GAAG,sBAAsB,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;IAClE,IAAI,UAAU,KAAK,OAAO,CAAC,qBAAqB,CAAC,YAAY,EAAE;AAC7D,QAAA,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAA;KAC9E;AAED,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM;AAChC,UAAE,MAAM,8BAA8B,CAClC,KAAK,EACL,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,IAAI,EACX,MAAM,EACN;AACE,YAAA,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC;YACrC,UAAU;YACV,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;YAC3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":"app.mjs","sources":["../src/app.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { _getAppArgsForABICall, _getBoxReference, legacySendAppTransactionBridge } from './transaction/legacy-bridge'\nimport { encodeLease, getSenderAddress } from './transaction/transaction'\nimport {\n ABIAppCallArgs,\n ABIReturn,\n AppCallArgs,\n AppCallParams,\n AppCallTransactionResult,\n AppCallType,\n AppCompilationResult,\n AppReference,\n AppState,\n BoxIdentifier,\n BoxName,\n BoxReference,\n BoxValueRequestParams,\n BoxValuesRequestParams,\n CompiledTeal,\n CreateAppParams,\n RawAppCallArgs,\n UpdateAppParams,\n} from './types/app'\nimport { AppManager } from './types/app-manager'\nimport { SendTransactionFrom } from './types/transaction'\nimport { toNumber } from './util'\nimport ABIMethod = algosdk.ABIMethod\nimport ABIMethodParams = algosdk.ABIMethodParams\nimport ABIValue = algosdk.ABIValue\nimport Address = algosdk.Address\nimport Algodv2 = algosdk.Algodv2\nimport modelsv2 = algosdk.modelsv2\nimport OnApplicationComplete = algosdk.OnApplicationComplete\n\n/**\n * @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`\n * / `algorand.createTransaction.appCreateMethodCall()` instead\n *\n * Creates a smart contract app, returns the details of the created app.\n * @param create The parameters to create the app with\n * @param algod An algod client\n * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result\n */\nexport async function createApp(\n create: CreateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult & AppReference> {\n const onComplete = getAppOnCompleteAction(create.onCompleteAction)\n if (onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot create an app with on-complete action of ClearState')\n }\n\n const result = create.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method),\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreateMethodCall,\n (c) => c.appCreateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreate,\n (c) => c.appCreate,\n )\n\n return { ...result, appId: 'appId' in result ? Number(result.appId) : 0, appAddress: 'appAddress' in result ? result.appAddress : '' }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Updates a smart contract app.\n * @param update The parameters to update the app with\n * @param algod An algod client\n * @returns The transaction send result and the compilation result\n */\nexport async function updateApp(\n update: UpdateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult> {\n return update.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method),\n },\n (c) => c.appUpdateMethodCall,\n (c) => c.appUpdateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n },\n (c) => c.appUpdate,\n (c) => c.appUpdate,\n )\n}\n\n/**\n * @deprecated Use `algosdk.OnApplicationComplete` directly instead.\n *\n * Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction.\n *\n * If given `undefined` will return `OnApplicationComplete.NoOpOC`.\n *\n * If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`.\n *\n * @param onCompletionAction The on completion action\n * @returns The `algosdk.OnApplicationComplete`\n */\nexport function getAppOnCompleteAction(onCompletionAction?: AppCallType | OnApplicationComplete) {\n switch (onCompletionAction) {\n case undefined:\n case 'no_op':\n case OnApplicationComplete.NoOpOC:\n return OnApplicationComplete.NoOpOC\n case 'opt_in':\n case OnApplicationComplete.OptInOC:\n return OnApplicationComplete.OptInOC\n case 'close_out':\n case OnApplicationComplete.CloseOutOC:\n return OnApplicationComplete.CloseOutOC\n case 'clear_state':\n case OnApplicationComplete.ClearStateOC:\n return OnApplicationComplete.ClearStateOC\n case 'update_application':\n case OnApplicationComplete.UpdateApplicationOC:\n return OnApplicationComplete.UpdateApplicationOC\n case 'delete_application':\n case OnApplicationComplete.DeleteApplicationOC:\n return OnApplicationComplete.DeleteApplicationOC\n }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Issues a call to a given app.\n * @param call The call details.\n * @param algod An algod client\n * @returns The result of the call\n */\nexport async function callApp(call: AppCallParams, algod: Algodv2): Promise<AppCallTransactionResult> {\n const onComplete = getAppOnCompleteAction(call.callType)\n if (onComplete === algosdk.OnApplicationComplete.UpdateApplicationOC) {\n throw new Error('Cannot execute an app call with on-complete action of Update')\n }\n if (call.args?.method && onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot execute an ABI method call with on-complete action of ClearState')\n }\n\n return call.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onComplete: onComplete as any,\n method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method),\n },\n (c) => c.appCallMethodCall,\n (c) => c.appCallMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n onComplete,\n },\n (c) => c.appCall,\n (c) => c.appCall,\n )\n}\n\n/**\n * @deprecated Use `AppManager.getABIReturn` instead.\n *\n * Returns any ABI return values for the given app call arguments and transaction confirmation.\n * @param args The arguments that were used for the call\n * @param confirmation The transaction confirmation from algod\n * @returns The return value for the method call\n */\nexport function getABIReturn(args?: AppCallArgs, confirmation?: modelsv2.PendingTransactionResponse): ABIReturn | undefined {\n if (!args || !args.method) {\n return undefined\n }\n const method = 'txnCount' in args.method ? args.method : new ABIMethod(args.method)\n\n return AppManager.getABIReturn(confirmation, method)\n}\n\n/**\n * @deprecated Use `algorand.app.getGlobalState` instead.\n *\n * Returns the current global state values for the given app ID\n * @param appId The ID of the app return global state for\n * @param algod An algod client instance\n * @returns The current global state\n */\nexport async function getAppGlobalState(appId: number | bigint, algod: Algodv2) {\n return await new AppManager(algod).getGlobalState(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getLocalState` instead.\n *\n * Returns the current global state values for the given app ID and account\n * @param appId The ID of the app return global state for\n * @param account Either the string address of an account or an account object for the account to get local state for the given app\n * @param algod An algod client instance\n * @returns The current local state for the given (app, account) combination\n */\nexport async function getAppLocalState(appId: number | bigint, account: string | SendTransactionFrom, algod: Algodv2) {\n return new AppManager(algod).getLocalState(BigInt(appId), getSenderAddress(account))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxNames` instead.\n * Returns the names of the boxes for the given app.\n * @param appId The ID of the app return box names for\n * @param algod An algod client instance\n * @returns The current box names\n */\nexport async function getAppBoxNames(appId: number | bigint, algod: Algodv2): Promise<BoxName[]> {\n return new AppManager(algod).getBoxNames(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValue` instead.\n * Returns the value of the given box name for the given app.\n * @param appId The ID of the app return box names for\n * @param boxName The name of the box to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box value as a byte array\n */\nexport async function getAppBoxValue(appId: number | bigint, boxName: string | Uint8Array | BoxName, algod: Algodv2): Promise<Uint8Array> {\n return new AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== 'string' && 'name' in boxName ? boxName.nameRaw : boxName)\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValues` instead.\n * Returns the value of the given box names for the given app.\n * @param appId The ID of the app return box names for\n * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box values as a byte array in the same order as the passed in box names\n */\nexport async function getAppBoxValues(appId: number, boxNames: (string | Uint8Array | BoxName)[], algod: Algodv2): Promise<Uint8Array[]> {\n return new AppManager(algod).getBoxValues(\n BigInt(appId),\n boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n )\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValueFromABIType` instead.\n * Returns the value of the given box name for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box value as an ABI value\n */\nexport async function getAppBoxValueFromABIType(request: BoxValueRequestParams, algod: Algodv2): Promise<ABIValue> {\n return new AppManager(algod).getBoxValueFromABIType({\n appId: BigInt(request.appId),\n boxName: typeof request.boxName !== 'string' && 'name' in request.boxName ? request.boxName.nameRaw : request.boxName,\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValuesFromABIType` instead.\n * Returns the value of the given box names for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box values as an ABI value in the same order as the passed in box names\n */\nexport async function getAppBoxValuesFromABIType(request: BoxValuesRequestParams, algod: Algodv2): Promise<ABIValue[]> {\n return new AppManager(algod).getBoxValuesFromABIType({\n appId: BigInt(request.appId),\n boxNames: request.boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `AppManager.decodeAppState` instead.\n *\n * Converts an array of global/local state values from the algod api to a more friendly\n * generic object keyed by the UTF-8 value of the key.\n * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`\n * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values\n */\nexport function decodeAppState(state: { key: string; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState {\n return AppManager.decodeAppState(state)\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an app `Transaction` object\n * @param args The app call args\n * @returns The args ready to load into a `Transaction`\n */\nexport function getAppArgsForTransaction(args?: RawAppCallArgs) {\n if (!args) return undefined\n\n const encoder = new TextEncoder()\n return {\n accounts: args?.accounts?.map(_getAccountAddress),\n appArgs: args?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)),\n boxes: args.boxes?.map(getBoxReference),\n foreignApps: args?.apps,\n foreignAssets: args?.assets,\n lease: encodeLease(args?.lease),\n }\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`\n * @param args The ABI app call args\n * @param from The transaction signer\n * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer\n */\nexport async function getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n return _getAppArgsForABICall(args, from)\n}\n\n/**\n * @deprecated Use `AppManager.getBoxReference()` instead.\n *\n * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.\n * @param box The box to return a reference for\n * @returns The box reference ready to pass into a `Transaction`\n */\nexport function getBoxReference(box: BoxIdentifier | BoxReference | algosdk.BoxReference): algosdk.BoxReference {\n return _getBoxReference(box)\n}\n\nfunction _getAccountAddress(account: string | Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/**\n * @deprecated Use `algorand.app.getById` instead.\n *\n * Gets the current data for the given app from algod.\n *\n * @param appId The id of the app\n * @param algod An algod client\n * @returns The data about the app\n */\nexport async function getAppById(appId: number | bigint, algod: Algodv2) {\n return modelsv2.Application.from_obj_for_encoding(await algod.getApplicationByID(toNumber(appId)).do())\n}\n\n/**\n * @deprecated Use `algorand.app.compileTeal` instead.\n *\n * Compiles the given TEAL using algod and returns the result, including source map.\n *\n * @param algod An algod client\n * @param tealCode The TEAL code\n * @returns The information about the compiled file\n */\nexport async function compileTeal(tealCode: string, algod: Algodv2): Promise<CompiledTeal> {\n return await new AppManager(algod).compileTeal(tealCode)\n}\n\n/**\n * @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead.\n *\n * Returns the encoded ABI spec for a given ABI Method\n * @param method The method to return a signature for\n * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`\n */\nexport const getABIMethodSignature = (method: ABIMethodParams | ABIMethod) => {\n return 'getSignature' in method ? method.getSignature() : new ABIMethod(method).getSignature()\n}\n"],"names":[],"mappings":";;;;;;AA0BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAKpC,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAClC,IAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAA;AAE5D;;;;;;;;AAQG;AACI,eAAe,SAAS,CAC7B,MAAuB,EACvB,KAAc,EAAA;IAEd,MAAM,UAAU,GAAG,sBAAsB,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;IAClE,IAAI,UAAU,KAAK,OAAO,CAAC,qBAAqB,CAAC,YAAY,EAAE;AAC7D,QAAA,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAA;KAC9E;AAED,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM;AAChC,UAAE,MAAM,8BAA8B,CAClC,KAAK,EACL,MAAM,CAAC,IAAI,E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U,MAAA,qBAAqB,GAAG,CAAC,MAAmC,KAAI;IAC3E,OAAO,cAAc,IAAI,MAAM,GAAG,MAAM,CAAC,YAAY,EAAE,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,CAAA;AAChG;;;;"}
package/asset.d.ts CHANGED
@@ -3,7 +3,7 @@ import { AssetBulkOptInOutParams, AssetOptInParams, AssetOptOutParams, CreateAss
3
3
  import { SendTransactionResult } from './types/transaction';
4
4
  import Algodv2 = algosdk.Algodv2;
5
5
  /**
6
- * @deprecated use `algorand.send.assetCreate()` / `algorand.transactions.assetCreate()` instead
6
+ * @deprecated use `algorand.send.assetCreate()` / `algorand.createTransaction.assetCreate()` instead
7
7
  *
8
8
  * Create an Algorand Standard Asset (ASA).
9
9
  * @param create The asset creation definition
@@ -21,7 +21,7 @@ export declare function createAsset(create: CreateAssetParams, algod: Algodv2):
21
21
  };
22
22
  }>;
23
23
  /**
24
- * @deprecated use `algorand.send.assetOptIn()` / `algorand.transactions.assetOptIn()` instead
24
+ * @deprecated use `algorand.send.assetOptIn()` / `algorand.createTransaction.assetOptIn()` instead
25
25
  *
26
26
  * Opt-in an account to an asset.
27
27
  * @param optIn The opt-in definition
@@ -35,7 +35,7 @@ export declare function createAsset(create: CreateAssetParams, algod: Algodv2):
35
35
  */
36
36
  export declare function assetOptIn(optIn: AssetOptInParams, algod: Algodv2): Promise<SendTransactionResult>;
37
37
  /**
38
- * @deprecated use `algorand.send.assetOptOut()` / `algorand.transactions.assetOptOut()` instead
38
+ * @deprecated use `algorand.send.assetOptOut()` / `algorand.createTransaction.assetOptOut()` instead
39
39
  *
40
40
  * Opt-out an account from an asset.
41
41
  * @param optOut The opt-in definition
package/asset.js CHANGED
@@ -5,7 +5,7 @@ var types_algorandClient = require('./types/algorand-client.js');
5
5
  var transaction = require('./transaction/transaction.js');
6
6
 
7
7
  /**
8
- * @deprecated use `algorand.send.assetCreate()` / `algorand.transactions.assetCreate()` instead
8
+ * @deprecated use `algorand.send.assetCreate()` / `algorand.createTransaction.assetCreate()` instead
9
9
  *
10
10
  * Create an Algorand Standard Asset (ASA).
11
11
  * @param create The asset creation definition
@@ -37,7 +37,7 @@ async function createAsset(create, algod) {
37
37
  return (await legacyBridge.legacySendTransactionBridge(algod, create.creator, create, params, (client) => client.assetCreate, (client) => client.assetCreate));
38
38
  }
39
39
  /**
40
- * @deprecated use `algorand.send.assetOptIn()` / `algorand.transactions.assetOptIn()` instead
40
+ * @deprecated use `algorand.send.assetOptIn()` / `algorand.createTransaction.assetOptIn()` instead
41
41
  *
42
42
  * Opt-in an account to an asset.
43
43
  * @param optIn The opt-in definition
@@ -59,7 +59,7 @@ async function assetOptIn(optIn, algod) {
59
59
  return legacyBridge.legacySendTransactionBridge(algod, optIn.account, optIn, params, (c) => c.assetOptIn, (c) => c.assetOptIn);
60
60
  }
61
61
  /**
62
- * @deprecated use `algorand.send.assetOptOut()` / `algorand.transactions.assetOptOut()` instead
62
+ * @deprecated use `algorand.send.assetOptOut()` / `algorand.createTransaction.assetOptOut()` instead
63
63
  *
64
64
  * Opt-out an account from an asset.
65
65
  * @param optOut The opt-in definition
package/asset.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"asset.js","sources":["../src/asset.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { encodeTransactionNote, getSenderAddress } from './transaction'\nimport { legacySendTransactionBridge } from './transaction/legacy-bridge'\nimport { AlgorandClient } from './types/algorand-client'\nimport { AssetBulkOptInOutParams, AssetOptInParams, AssetOptOutParams, CreateAssetParams } from './types/asset'\nimport { AssetCreateParams, AssetOptInParams as NewAssetOptInParams, AssetOptOutParams as NewAssetOptOutParams } from './types/composer'\nimport { SendTransactionResult } from './types/transaction'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated use `algorand.send.assetCreate()` / `algorand.transactions.assetCreate()` instead\n *\n * Create an Algorand Standard Asset (ASA).\n * @param create The asset creation definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.createAsset({ creator: account, total: 1, decimals: 0, name: 'My asset' }, algod)\n * ```\n */\nexport async function createAsset(\n create: CreateAssetParams,\n algod: Algodv2,\n): Promise<SendTransactionResult & { confirmation?: { assetIndex: number | bigint } }> {\n const params: AssetCreateParams = {\n sender: getSenderAddress(create.creator),\n total: BigInt(create.total),\n decimals: create.decimals,\n assetName: create.name,\n unitName: create.unit,\n manager: create.manager ? getSenderAddress(create.manager) : undefined,\n clawback: create.clawbackAccount ? getSenderAddress(create.clawbackAccount) : undefined,\n freeze: create.freezeAccount ? getSenderAddress(create.freezeAccount) : undefined,\n reserve: create.reserveAccount ? getSenderAddress(create.reserveAccount) : undefined,\n defaultFrozen: create.frozenByDefault,\n lease: create.lease,\n metadataHash: create.metadataHash,\n note: encodeTransactionNote(create.note),\n url: create.url,\n }\n\n return (await legacySendTransactionBridge(\n algod,\n create.creator,\n create,\n params,\n (client) => client.assetCreate,\n (client) => client.assetCreate,\n )) as SendTransactionResult & { confirmation: { assetIndex: number | bigint } }\n}\n\n/**\n * @deprecated use `algorand.send.assetOptIn()` / `algorand.transactions.assetOptIn()` instead\n *\n * Opt-in an account to an asset.\n * @param optIn The opt-in definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.assetOptIn({ account, assetId }, algod)\n * ```\n */\nexport async function assetOptIn(optIn: AssetOptInParams, algod: Algodv2): Promise<SendTransactionResult> {\n const params: NewAssetOptInParams = {\n assetId: BigInt(optIn.assetId),\n sender: getSenderAddress(optIn.account),\n note: encodeTransactionNote(optIn.note),\n lease: optIn.lease,\n }\n\n return legacySendTransactionBridge(\n algod,\n optIn.account,\n optIn,\n params,\n (c) => c.assetOptIn,\n (c) => c.assetOptIn,\n )\n}\n\n/**\n * @deprecated use `algorand.send.assetOptOut()` / `algorand.transactions.assetOptOut()` instead\n *\n * Opt-out an account from an asset.\n * @param optOut The opt-in definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.assetOptOut({ account, assetId, assetCreatorAddress }, algod)\n * ```\n */\nexport async function assetOptOut(optOut: AssetOptOutParams, algod: Algodv2): Promise<SendTransactionResult> {\n const assetCreatorAddress = optOut.assetCreatorAddress ?? (await algod.getAssetByID(optOut.assetId).do()).params.creator\n\n const params: NewAssetOptOutParams = {\n assetId: BigInt(optOut.assetId),\n creator: assetCreatorAddress,\n sender: getSenderAddress(optOut.account),\n note: encodeTransactionNote(optOut.note),\n lease: optOut.lease,\n }\n\n return legacySendTransactionBridge(\n algod,\n optOut.account,\n optOut,\n params,\n (c) => c.assetOptOut,\n (c) => (params: NewAssetOptOutParams) => c.assetOptOut({ ...params, ensureZeroBalance: optOut.ensureZeroBalance ?? true }),\n )\n}\n\n/**\n * @deprecated use `algorand.asset.bulkOptIn()` instead\n *\n * Opt in to a list of assets on the Algorand blockchain.\n *\n * @param optIn - The bulk opt-in request.\n * @param algod - An instance of the Algodv2 class from the `algosdk` library.\n * @returns A record object where the keys are the asset IDs and the values are the corresponding transaction IDs for successful opt-ins.\n * @throws If there is an error during the opt-in process.\n * @example algokit.bulkOptIn({ account: account, assetIds: [12345, 67890] }, algod)\n */\nexport async function assetBulkOptIn(optIn: AssetBulkOptInOutParams, algod: Algodv2): Promise<Record<number, string>> {\n const result = await AlgorandClient.fromClients({ algod })\n .setSignerFromAccount(optIn.account)\n .asset.bulkOptIn(getSenderAddress(optIn.account), optIn.assetIds.map(BigInt), {\n note: encodeTransactionNote(optIn.note),\n maxFee: optIn.maxFee,\n suppressLog: optIn.suppressLog,\n })\n\n const returnResult: Record<number, string> = {}\n for (const r of result) {\n returnResult[Number(r.assetId)] = r.transactionId\n }\n return returnResult\n}\n\n/**\n * @deprecated use `algorand.asset.bulkOptOut()` instead\n *\n * Opt out of multiple assets in Algorand blockchain.\n *\n * @param optOut The bulk opt-out request.\n * @param algod - An instance of the Algodv2 client used to interact with the Algorand blockchain.\n * @returns A record object containing asset IDs as keys and their corresponding transaction IDs as values.\n * @throws If there is an error during the opt-out process.\n * @example algokit.bulkOptOut({ account: account, assetIds: [12345, 67890] }, algod)\n */\nexport async function assetBulkOptOut(optOut: AssetBulkOptInOutParams, algod: Algodv2): Promise<Record<number, string>> {\n const result = await AlgorandClient.fromClients({ algod })\n .setSignerFromAccount(optOut.account)\n .asset.bulkOptOut(getSenderAddress(optOut.account), optOut.assetIds.map(BigInt), {\n ensureZeroBalance: optOut.validateBalances ?? true,\n note: encodeTransactionNote(optOut.note),\n maxFee: optOut.maxFee,\n suppressLog: optOut.suppressLog,\n })\n\n const returnResult: Record<number, string> = {}\n for (const r of result) {\n returnResult[Number(r.assetId)] = r.transactionId\n }\n return returnResult\n}\n"],"names":["getSenderAddress","encodeTransactionNote","legacySendTransactionBridge","AlgorandClient"],"mappings":";;;;;;AASA;;;;;;;;;;;;AAYG;AACI,eAAe,WAAW,CAC/B,MAAyB,EACzB,KAAc,EAAA;AAEd,IAAA,MAAM,MAAM,GAAsB;AAChC,QAAA,MAAM,EAAEA,4BAAgB,CAAC,MAAM,CAAC,OAAO,CAAC;AACxC,QAAA,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,SAAS,EAAE,MAAM,CAAC,IAAI;QACtB,QAAQ,EAAE,MAAM,CAAC,IAAI;AACrB,QAAA,OAAO,EAAE,MAAM,CAAC,OAAO,GAAGA,4BAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,SAAS;AACtE,QAAA,QAAQ,EAAE,MAAM,CAAC,eAAe,GAAGA,4BAAgB,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,SAAS;AACvF,QAAA,MAAM,EAAE,MAAM,CAAC,aAAa,GAAGA,4BA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AC/C,IAAA,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE;AACtB,QAAA,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,aAAa,CAAA;KAClD;AACD,IAAA,OAAO,YAAY,CAAA;AACrB,CAAC;AAED;;;;;;;;;;AAUG;AACI,eAAe,eAAe,CAAC,MAA+B,EAAE,KAAc,EAAA;IACnF,MAAM,MAAM,GAAG,MAAME,mCAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;AACvD,SAAA,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC;AACpC,SAAA,KAAK,CAAC,UAAU,CAACH,4BAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;AAC/E,QAAA,iBAAiB,EAAE,MAAM,CAAC,gBAAgB,IAAI,IAAI;AAClD,QAAA,IAAI,EAAEC,iCAAqB,CAAC,MAAM,CAAC,IAAI,CAAC;QACxC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,WAAW,EAAE,MAAM,CAAC,WAAW;AAChC,KAAA,CAAC,CAAA;IAEJ,MAAM,YAAY,GAA2B,EAAE,CAAA;AAC/C,IAAA,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE;AACtB,QAAA,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,aAAa,CAAA;KAClD;AACD,IAAA,OAAO,YAAY,CAAA;AACrB;;;;;;;;"}
1
+ {"version":3,"file":"asset.js","sources":["../src/asset.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { encodeTransactionNote, getSenderAddress } from './transaction'\nimport { legacySendTransactionBridge } from './transaction/legacy-bridge'\nimport { AlgorandClient } from './types/algorand-client'\nimport { AssetBulkOptInOutParams, AssetOptInParams, AssetOptOutParams, CreateAssetParams } from './types/asset'\nimport { AssetCreateParams, AssetOptInParams as NewAssetOptInParams, AssetOptOutParams as NewAssetOptOutParams } from './types/composer'\nimport { SendTransactionResult } from './types/transaction'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated use `algorand.send.assetCreate()` / `algorand.createTransaction.assetCreate()` instead\n *\n * Create an Algorand Standard Asset (ASA).\n * @param create The asset creation definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.createAsset({ creator: account, total: 1, decimals: 0, name: 'My asset' }, algod)\n * ```\n */\nexport async function createAsset(\n create: CreateAssetParams,\n algod: Algodv2,\n): Promise<SendTransactionResult & { confirmation?: { assetIndex: number | bigint } }> {\n const params: AssetCreateParams = {\n sender: getSenderAddress(create.creator),\n total: BigInt(create.total),\n decimals: create.decimals,\n assetName: create.name,\n unitName: create.unit,\n manager: create.manager ? getSenderAddress(create.manager) : undefined,\n clawback: create.clawbackAccount ? getSenderAddress(create.clawbackAccount) : undefined,\n freeze: create.freezeAccount ? getSenderAddress(create.freezeAccount) : undefined,\n reserve: create.reserveAccount ? getSenderAddress(create.reserveAccount) : undefined,\n defaultFrozen: create.frozenByDefault,\n lease: create.lease,\n metadataHash: create.metadataHash,\n note: encodeTransactionNote(create.note),\n url: create.url,\n }\n\n return (await legacySendTransactionBridge(\n algod,\n create.creator,\n create,\n params,\n (client) => client.assetCreate,\n (client) => client.assetCreate,\n )) as SendTransactionResult & { confirmation: { assetIndex: number | bigint } }\n}\n\n/**\n * @deprecated use `algorand.send.assetOptIn()` / `algorand.createTransaction.assetOptIn()` instead\n *\n * Opt-in an account to an asset.\n * @param optIn The opt-in definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.assetOptIn({ account, assetId }, algod)\n * ```\n */\nexport async function assetOptIn(optIn: AssetOptInParams, algod: Algodv2): Promise<SendTransactionResult> {\n const params: NewAssetOptInParams = {\n assetId: BigInt(optIn.assetId),\n sender: getSenderAddress(optIn.account),\n note: encodeTransactionNote(optIn.note),\n lease: optIn.lease,\n }\n\n return legacySendTransactionBridge(\n algod,\n optIn.account,\n optIn,\n params,\n (c) => c.assetOptIn,\n (c) => c.assetOptIn,\n )\n}\n\n/**\n * @deprecated use `algorand.send.assetOptOut()` / `algorand.createTransaction.assetOptOut()` instead\n *\n * Opt-out an account from an asset.\n * @param optOut The opt-in definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.assetOptOut({ account, assetId, assetCreatorAddress }, algod)\n * ```\n */\nexport async function assetOptOut(optOut: AssetOptOutParams, algod: Algodv2): Promise<SendTransactionResult> {\n const assetCreatorAddress = optOut.assetCreatorAddress ?? (await algod.getAssetByID(optOut.assetId).do()).params.creator\n\n const params: NewAssetOptOutParams = {\n assetId: BigInt(optOut.assetId),\n creator: assetCreatorAddress,\n sender: getSenderAddress(optOut.account),\n note: encodeTransactionNote(optOut.note),\n lease: optOut.lease,\n }\n\n return legacySendTransactionBridge(\n algod,\n optOut.account,\n optOut,\n params,\n (c) => c.assetOptOut,\n (c) => (params: NewAssetOptOutParams) => c.assetOptOut({ ...params, ensureZeroBalance: optOut.ensureZeroBalance ?? true }),\n )\n}\n\n/**\n * @deprecated use `algorand.asset.bulkOptIn()` instead\n *\n * Opt in to a list of assets on the Algorand blockchain.\n *\n * @param optIn - The bulk opt-in request.\n * @param algod - An instance of the Algodv2 class from the `algosdk` library.\n * @returns A record object where the keys are the asset IDs and the values are the corresponding transaction IDs for successful opt-ins.\n * @throws If there is an error during the opt-in process.\n * @example algokit.bulkOptIn({ account: account, assetIds: [12345, 67890] }, algod)\n */\nexport async function assetBulkOptIn(optIn: AssetBulkOptInOutParams, algod: Algodv2): Promise<Record<number, string>> {\n const result = await AlgorandClient.fromClients({ algod })\n .setSignerFromAccount(optIn.account)\n .asset.bulkOptIn(getSenderAddress(optIn.account), optIn.assetIds.map(BigInt), {\n note: encodeTransactionNote(optIn.note),\n maxFee: optIn.maxFee,\n suppressLog: optIn.suppressLog,\n })\n\n const returnResult: Record<number, string> = {}\n for (const r of result) {\n returnResult[Number(r.assetId)] = r.transactionId\n }\n return returnResult\n}\n\n/**\n * @deprecated use `algorand.asset.bulkOptOut()` instead\n *\n * Opt out of multiple assets in Algorand blockchain.\n *\n * @param optOut The bulk opt-out request.\n * @param algod - An instance of the Algodv2 client used to interact with the Algorand blockchain.\n * @returns A record object containing asset IDs as keys and their corresponding transaction IDs as values.\n * @throws If there is an error during the opt-out process.\n * @example algokit.bulkOptOut({ account: account, assetIds: [12345, 67890] }, algod)\n */\nexport async function assetBulkOptOut(optOut: AssetBulkOptInOutParams, algod: Algodv2): Promise<Record<number, string>> {\n const result = await AlgorandClient.fromClients({ algod })\n .setSignerFromAccount(optOut.account)\n .asset.bulkOptOut(getSenderAddress(optOut.account), optOut.assetIds.map(BigInt), {\n ensureZeroBalance: optOut.validateBalances ?? true,\n note: encodeTransactionNote(optOut.note),\n maxFee: optOut.maxFee,\n suppressLog: optOut.suppressLog,\n })\n\n const returnResult: Record<number, string> = {}\n for (const r of result) {\n returnResult[Number(r.assetId)] = r.transactionId\n }\n return returnResult\n}\n"],"names":["getSenderAddress","encodeTransactionNote","legacySendTransactionBridge","AlgorandClient"],"mappings":";;;;;;AASA;;;;;;;;;;;;AAYG;AACI,eAAe,WAAW,CAC/B,MAAyB,EACzB,KAAc,EAAA;AAEd,IAAA,MAAM,MAAM,GAAsB;AAChC,QAAA,MAAM,EAAEA,4BAAgB,CAAC,MAAM,CAAC,OAAO,CAAC;AACxC,QAAA,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,SAAS,EAAE,MAAM,CAAC,IAAI;QACtB,QAAQ,EAAE,MAAM,CAAC,IAAI;AACr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}
package/asset.mjs CHANGED
@@ -3,7 +3,7 @@ import { AlgorandClient } from './types/algorand-client.mjs';
3
3
  import { getSenderAddress, encodeTransactionNote } from './transaction/transaction.mjs';
4
4
 
5
5
  /**
6
- * @deprecated use `algorand.send.assetCreate()` / `algorand.transactions.assetCreate()` instead
6
+ * @deprecated use `algorand.send.assetCreate()` / `algorand.createTransaction.assetCreate()` instead
7
7
  *
8
8
  * Create an Algorand Standard Asset (ASA).
9
9
  * @param create The asset creation definition
@@ -35,7 +35,7 @@ async function createAsset(create, algod) {
35
35
  return (await legacySendTransactionBridge(algod, create.creator, create, params, (client) => client.assetCreate, (client) => client.assetCreate));
36
36
  }
37
37
  /**
38
- * @deprecated use `algorand.send.assetOptIn()` / `algorand.transactions.assetOptIn()` instead
38
+ * @deprecated use `algorand.send.assetOptIn()` / `algorand.createTransaction.assetOptIn()` instead
39
39
  *
40
40
  * Opt-in an account to an asset.
41
41
  * @param optIn The opt-in definition
@@ -57,7 +57,7 @@ async function assetOptIn(optIn, algod) {
57
57
  return legacySendTransactionBridge(algod, optIn.account, optIn, params, (c) => c.assetOptIn, (c) => c.assetOptIn);
58
58
  }
59
59
  /**
60
- * @deprecated use `algorand.send.assetOptOut()` / `algorand.transactions.assetOptOut()` instead
60
+ * @deprecated use `algorand.send.assetOptOut()` / `algorand.createTransaction.assetOptOut()` instead
61
61
  *
62
62
  * Opt-out an account from an asset.
63
63
  * @param optOut The opt-in definition
package/asset.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"asset.mjs","sources":["../src/asset.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { encodeTransactionNote, getSenderAddress } from './transaction'\nimport { legacySendTransactionBridge } from './transaction/legacy-bridge'\nimport { AlgorandClient } from './types/algorand-client'\nimport { AssetBulkOptInOutParams, AssetOptInParams, AssetOptOutParams, CreateAssetParams } from './types/asset'\nimport { AssetCreateParams, AssetOptInParams as NewAssetOptInParams, AssetOptOutParams as NewAssetOptOutParams } from './types/composer'\nimport { SendTransactionResult } from './types/transaction'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated use `algorand.send.assetCreate()` / `algorand.transactions.assetCreate()` instead\n *\n * Create an Algorand Standard Asset (ASA).\n * @param create The asset creation definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.createAsset({ creator: account, total: 1, decimals: 0, name: 'My asset' }, algod)\n * ```\n */\nexport async function createAsset(\n create: CreateAssetParams,\n algod: Algodv2,\n): Promise<SendTransactionResult & { confirmation?: { assetIndex: number | bigint } }> {\n const params: AssetCreateParams = {\n sender: getSenderAddress(create.creator),\n total: BigInt(create.total),\n decimals: create.decimals,\n assetName: create.name,\n unitName: create.unit,\n manager: create.manager ? getSenderAddress(create.manager) : undefined,\n clawback: create.clawbackAccount ? getSenderAddress(create.clawbackAccount) : undefined,\n freeze: create.freezeAccount ? getSenderAddress(create.freezeAccount) : undefined,\n reserve: create.reserveAccount ? getSenderAddress(create.reserveAccount) : undefined,\n defaultFrozen: create.frozenByDefault,\n lease: create.lease,\n metadataHash: create.metadataHash,\n note: encodeTransactionNote(create.note),\n url: create.url,\n }\n\n return (await legacySendTransactionBridge(\n algod,\n create.creator,\n create,\n params,\n (client) => client.assetCreate,\n (client) => client.assetCreate,\n )) as SendTransactionResult & { confirmation: { assetIndex: number | bigint } }\n}\n\n/**\n * @deprecated use `algorand.send.assetOptIn()` / `algorand.transactions.assetOptIn()` instead\n *\n * Opt-in an account to an asset.\n * @param optIn The opt-in definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.assetOptIn({ account, assetId }, algod)\n * ```\n */\nexport async function assetOptIn(optIn: AssetOptInParams, algod: Algodv2): Promise<SendTransactionResult> {\n const params: NewAssetOptInParams = {\n assetId: BigInt(optIn.assetId),\n sender: getSenderAddress(optIn.account),\n note: encodeTransactionNote(optIn.note),\n lease: optIn.lease,\n }\n\n return legacySendTransactionBridge(\n algod,\n optIn.account,\n optIn,\n params,\n (c) => c.assetOptIn,\n (c) => c.assetOptIn,\n )\n}\n\n/**\n * @deprecated use `algorand.send.assetOptOut()` / `algorand.transactions.assetOptOut()` instead\n *\n * Opt-out an account from an asset.\n * @param optOut The opt-in definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.assetOptOut({ account, assetId, assetCreatorAddress }, algod)\n * ```\n */\nexport async function assetOptOut(optOut: AssetOptOutParams, algod: Algodv2): Promise<SendTransactionResult> {\n const assetCreatorAddress = optOut.assetCreatorAddress ?? (await algod.getAssetByID(optOut.assetId).do()).params.creator\n\n const params: NewAssetOptOutParams = {\n assetId: BigInt(optOut.assetId),\n creator: assetCreatorAddress,\n sender: getSenderAddress(optOut.account),\n note: encodeTransactionNote(optOut.note),\n lease: optOut.lease,\n }\n\n return legacySendTransactionBridge(\n algod,\n optOut.account,\n optOut,\n params,\n (c) => c.assetOptOut,\n (c) => (params: NewAssetOptOutParams) => c.assetOptOut({ ...params, ensureZeroBalance: optOut.ensureZeroBalance ?? true }),\n )\n}\n\n/**\n * @deprecated use `algorand.asset.bulkOptIn()` instead\n *\n * Opt in to a list of assets on the Algorand blockchain.\n *\n * @param optIn - The bulk opt-in request.\n * @param algod - An instance of the Algodv2 class from the `algosdk` library.\n * @returns A record object where the keys are the asset IDs and the values are the corresponding transaction IDs for successful opt-ins.\n * @throws If there is an error during the opt-in process.\n * @example algokit.bulkOptIn({ account: account, assetIds: [12345, 67890] }, algod)\n */\nexport async function assetBulkOptIn(optIn: AssetBulkOptInOutParams, algod: Algodv2): Promise<Record<number, string>> {\n const result = await AlgorandClient.fromClients({ algod })\n .setSignerFromAccount(optIn.account)\n .asset.bulkOptIn(getSenderAddress(optIn.account), optIn.assetIds.map(BigInt), {\n note: encodeTransactionNote(optIn.note),\n maxFee: optIn.maxFee,\n suppressLog: optIn.suppressLog,\n })\n\n const returnResult: Record<number, string> = {}\n for (const r of result) {\n returnResult[Number(r.assetId)] = r.transactionId\n }\n return returnResult\n}\n\n/**\n * @deprecated use `algorand.asset.bulkOptOut()` instead\n *\n * Opt out of multiple assets in Algorand blockchain.\n *\n * @param optOut The bulk opt-out request.\n * @param algod - An instance of the Algodv2 client used to interact with the Algorand blockchain.\n * @returns A record object containing asset IDs as keys and their corresponding transaction IDs as values.\n * @throws If there is an error during the opt-out process.\n * @example algokit.bulkOptOut({ account: account, assetIds: [12345, 67890] }, algod)\n */\nexport async function assetBulkOptOut(optOut: AssetBulkOptInOutParams, algod: Algodv2): Promise<Record<number, string>> {\n const result = await AlgorandClient.fromClients({ algod })\n .setSignerFromAccount(optOut.account)\n .asset.bulkOptOut(getSenderAddress(optOut.account), optOut.assetIds.map(BigInt), {\n ensureZeroBalance: optOut.validateBalances ?? true,\n note: encodeTransactionNote(optOut.note),\n maxFee: optOut.maxFee,\n suppressLog: optOut.suppressLog,\n })\n\n const returnResult: Record<number, string> = {}\n for (const r of result) {\n returnResult[Number(r.assetId)] = r.transactionId\n }\n return returnResult\n}\n"],"names":[],"mappings":";;;;AASA;;;;;;;;;;;;AAYG;AACI,eAAe,WAAW,CAC/B,MAAyB,EACzB,KAAc,EAAA;AAEd,IAAA,MAAM,MAAM,GAAsB;AAChC,QAAA,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC;AACxC,QAAA,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,SAAS,EAAE,MAAM,CAAC,IAAI;QACtB,QAAQ,EAAE,MAAM,CAAC,IAAI;AACrB,QAAA,OAAO,EAAE,MAAM,CAAC,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,SAAS;AACtE,QAAA,QAAQ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KAAK,CAAC,MAAM;QACpB,WAAW,EAAE,KAAK,CAAC,WAAW;AAC/B,KAAA,CAAC,CAAA;IAEJ,MAAM,YAAY,GAA2B,EAAE,CAAA;AAC/C,IAAA,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE;AACtB,QAAA,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,aAAa,CAAA;KAClD;AACD,IAAA,OAAO,YAAY,CAAA;AACrB,CAAC;AAED;;;;;;;;;;AAUG;AACI,eAAe,eAAe,CAAC,MAA+B,EAAE,KAAc,EAAA;IACnF,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;AACvD,SAAA,oBAAoB,CAAC,MAAM,CAAC,OAAO,CAAC;AACpC,SAAA,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;AAC/E,QAAA,iBAAiB,EAAE,MAAM,CAAC,gBAAgB,IAAI,IAAI;AAClD,QAAA,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC;QACxC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,WAAW,EAAE,MAAM,CAAC,WAAW;AAChC,KAAA,CAAC,CAAA;IAEJ,MAAM,YAAY,GAA2B,EAAE,CAAA;AAC/C,IAAA,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE;AACtB,QAAA,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,aAAa,CAAA;KAClD;AACD,IAAA,OAAO,YAAY,CAAA;AACrB;;;;"}
1
+ {"version":3,"file":"asset.mjs","sources":["../src/asset.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { encodeTransactionNote, getSenderAddress } from './transaction'\nimport { legacySendTransactionBridge } from './transaction/legacy-bridge'\nimport { AlgorandClient } from './types/algorand-client'\nimport { AssetBulkOptInOutParams, AssetOptInParams, AssetOptOutParams, CreateAssetParams } from './types/asset'\nimport { AssetCreateParams, AssetOptInParams as NewAssetOptInParams, AssetOptOutParams as NewAssetOptOutParams } from './types/composer'\nimport { SendTransactionResult } from './types/transaction'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated use `algorand.send.assetCreate()` / `algorand.createTransaction.assetCreate()` instead\n *\n * Create an Algorand Standard Asset (ASA).\n * @param create The asset creation definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.createAsset({ creator: account, total: 1, decimals: 0, name: 'My asset' }, algod)\n * ```\n */\nexport async function createAsset(\n create: CreateAssetParams,\n algod: Algodv2,\n): Promise<SendTransactionResult & { confirmation?: { assetIndex: number | bigint } }> {\n const params: AssetCreateParams = {\n sender: getSenderAddress(create.creator),\n total: BigInt(create.total),\n decimals: create.decimals,\n assetName: create.name,\n unitName: create.unit,\n manager: create.manager ? getSenderAddress(create.manager) : undefined,\n clawback: create.clawbackAccount ? getSenderAddress(create.clawbackAccount) : undefined,\n freeze: create.freezeAccount ? getSenderAddress(create.freezeAccount) : undefined,\n reserve: create.reserveAccount ? getSenderAddress(create.reserveAccount) : undefined,\n defaultFrozen: create.frozenByDefault,\n lease: create.lease,\n metadataHash: create.metadataHash,\n note: encodeTransactionNote(create.note),\n url: create.url,\n }\n\n return (await legacySendTransactionBridge(\n algod,\n create.creator,\n create,\n params,\n (client) => client.assetCreate,\n (client) => client.assetCreate,\n )) as SendTransactionResult & { confirmation: { assetIndex: number | bigint } }\n}\n\n/**\n * @deprecated use `algorand.send.assetOptIn()` / `algorand.createTransaction.assetOptIn()` instead\n *\n * Opt-in an account to an asset.\n * @param optIn The opt-in definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.assetOptIn({ account, assetId }, algod)\n * ```\n */\nexport async function assetOptIn(optIn: AssetOptInParams, algod: Algodv2): Promise<SendTransactionResult> {\n const params: NewAssetOptInParams = {\n assetId: BigInt(optIn.assetId),\n sender: getSenderAddress(optIn.account),\n note: encodeTransactionNote(optIn.note),\n lease: optIn.lease,\n }\n\n return legacySendTransactionBridge(\n algod,\n optIn.account,\n optIn,\n params,\n (c) => c.assetOptIn,\n (c) => c.assetOptIn,\n )\n}\n\n/**\n * @deprecated use `algorand.send.assetOptOut()` / `algorand.createTransaction.assetOptOut()` instead\n *\n * Opt-out an account from an asset.\n * @param optOut The opt-in definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.assetOptOut({ account, assetId, assetCreatorAddress }, algod)\n * ```\n */\nexport async function assetOptOut(optOut: AssetOptOutParams, algod: Algodv2): Promise<SendTransactionResult> {\n const assetCreatorAddress = optOut.assetCreatorAddress ?? (await algod.getAssetByID(optOut.assetId).do()).params.creator\n\n const params: NewAssetOptOutParams = {\n assetId: BigInt(optOut.assetId),\n creator: assetCreatorAddress,\n sender: getSenderAddress(optOut.account),\n note: encodeTransactionNote(optOut.note),\n lease: optOut.lease,\n }\n\n return legacySendTransactionBridge(\n algod,\n optOut.account,\n optOut,\n params,\n (c) => c.assetOptOut,\n (c) => (params: NewAssetOptOutParams) => c.assetOptOut({ ...params, ensureZeroBalance: optOut.ensureZeroBalance ?? true }),\n )\n}\n\n/**\n * @deprecated use `algorand.asset.bulkOptIn()` instead\n *\n * Opt in to a list of assets on the Algorand blockchain.\n *\n * @param optIn - The bulk opt-in request.\n * @param algod - An instance of the Algodv2 class from the `algosdk` library.\n * @returns A record object where the keys are the asset IDs and the values are the corresponding transaction IDs for successful opt-ins.\n * @throws If there is an error during the opt-in process.\n * @example algokit.bulkOptIn({ account: account, assetIds: [12345, 67890] }, algod)\n */\nexport async function assetBulkOptIn(optIn: AssetBulkOptInOutParams, algod: Algodv2): Promise<Record<number, string>> {\n const result = await AlgorandClient.fromClients({ algod })\n .setSignerFromAccount(optIn.account)\n .asset.bulkOptIn(getSenderAddress(optIn.account), optIn.assetIds.map(BigInt), {\n note: encodeTransactionNote(optIn.note),\n maxFee: optIn.maxFee,\n suppressLog: optIn.suppressLog,\n })\n\n const returnResult: Record<number, string> = {}\n for (const r of result) {\n returnResult[Number(r.assetId)] = r.transactionId\n }\n return returnResult\n}\n\n/**\n * @deprecated use `algorand.asset.bulkOptOut()` instead\n *\n * Opt out of multiple assets in Algorand blockchain.\n *\n * @param optOut The bulk opt-out request.\n * @param algod - An instance of the Algodv2 client used to interact with the Algorand blockchain.\n * @returns A record object containing asset IDs as keys and their corresponding transaction IDs as values.\n * @throws If there is an error during the opt-out process.\n * @example algokit.bulkOptOut({ account: account, assetIds: [12345, 67890] }, algod)\n */\nexport async function assetBulkOptOut(optOut: AssetBulkOptInOutParams, algod: Algodv2): Promise<Record<number, string>> {\n const result = await AlgorandClient.fromClients({ algod })\n .setSignerFromAccount(optOut.account)\n .asset.bulkOptOut(getSenderAddress(optOut.account), optOut.assetIds.map(BigInt), {\n ensureZeroBalance: optOut.validateBalances ?? true,\n note: encodeTransactionNote(optOut.note),\n maxFee: optOut.maxFee,\n suppressLog: optOut.suppressLog,\n })\n\n const returnResult: Record<number, string> = {}\n for (const r of result) {\n returnResult[Number(r.assetId)] = r.transactionId\n }\n return returnResult\n}\n"],"names":[],"mappings":";;;;AASA;;;;;;;;;;;;AAYG;AACI,eAAe,WAAW,CAC/B,MAAyB,EACzB,KAAc,EAAA;AAEd,IAAA,MAAM,MAAM,GAAsB;AAChC,QAAA,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC;AACxC,QAAA,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,SAAS,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AACD,IAAA,OAAO,YAAY,CAAA;AACrB;;;;"}
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "**"
7
7
  ],
8
8
  "name": "@algorandfoundation/algokit-utils",
9
- "version": "7.0.0-beta.6",
9
+ "version": "7.0.0-beta.8",
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",
@@ -25,7 +25,7 @@ function algorandFixture(fixtureConfig, config$1) {
25
25
  const transactionLoggerAlgod = transactionLogger$1.capture(algod);
26
26
  algorand = types_algorandClient.AlgorandClient.fromClients({ algod: transactionLoggerAlgod, indexer: indexer$1, kmd });
27
27
  const acc = await account.getTestAccount({ initialFunds: fixtureConfig?.testAccountFunding ?? amount.algos(10), suppressLog: true }, algorand);
28
- algorand.setSignerFromAccount(acc).setSuggestedParamsTimeout(0);
28
+ algorand.setSignerFromAccount(acc).setSuggestedParamsCacheTimeout(0);
29
29
  // If running against LocalNet we are likely in dev mode and we need to set a much higher validity window
30
30
  // otherwise we are more likely to get invalid transactions.
31
31
  if (await algorand.client.isLocalNet()) {
@@ -1 +1 @@
1
- {"version":3,"file":"algorand-fixture.js","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"sourcesContent":["import { algos, Config, lookupTransactionById } from '../../'\nimport AlgorandClient from '../../types/algorand-client'\nimport { ClientManager } from '../../types/client-manager'\nimport { AlgoConfig } from '../../types/network-client'\nimport { AlgorandFixture, AlgorandFixtureConfig, AlgorandTestAutomationContext, GetTestAccountParams } from '../../types/testing'\nimport { getTestAccount } from '../account'\nimport { runWhenIndexerCaughtUp } from '../indexer'\nimport { TransactionLogger } from '../transaction-logger'\n\n/**\n * Creates a test fixture for automated testing against Algorand.\n * By default it tests against an environment variable specified client\n * if the standard environment variables are specified, otherwise against\n * a default LocalNet instance, but you can pass in an algod, indexer\n * and/or kmd (or their respective config) if you want to test against\n * an explicitly defined network.\n *\n * @example No config\n * ```typescript\n * const algorand = algorandFixture()\n *\n * beforeEach(algorand.beforeEach, 10_000)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = algorand.context\n * // test things...\n * })\n * ```\n *\n * @example With config\n * ```typescript\n * const algorand = algorandFixture({\n * algod: new Algodv2('localhost', 12345, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),\n * // ...\n * })\n *\n * beforeEach(algorand.beforeEach, 10_000)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = algorand.context\n * // test things...\n * })\n * ```\n *\n * @param fixtureConfig The fixture configuration\n * @returns The fixture\n */\nexport function algorandFixture(fixtureConfig?: AlgorandFixtureConfig): AlgorandFixture\n\n/**\n * @deprecated Config can be passed in directly to fixture config now.\n *\n * Creates a test fixture for automated testing against Algorand.\n * By default it tests against an environment variable specified client\n * if the standard environment variables are specified, otherwise against\n * a default LocalNet instance, but you can pass in an algod, indexer\n * and/or kmd if you want to test against an explicitly defined network.\n *\n * @example\n * ```typescript\n * const algorand = algorandFixture(undefined, getConfigFromEnvOrDefaults())\n *\n * beforeEach(algorand.beforeEach, 10_000)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = algorand.context\n * // test things...\n * })\n * ```\n *\n * @param fixtureConfig The fixture configuration\n * @param config The fixture configuration\n * @returns The fixture\n */\nexport function algorandFixture(fixtureConfig: AlgorandFixtureConfig | undefined, config: AlgoConfig): AlgorandFixture\n\nexport function algorandFixture(fixtureConfig?: AlgorandFixtureConfig, config?: AlgoConfig): AlgorandFixture {\n fixtureConfig = { ...fixtureConfig, ...config }\n if (!fixtureConfig.algod || !fixtureConfig.indexer || !fixtureConfig.kmd) {\n fixtureConfig = { ...ClientManager.getConfigFromEnvironmentOrLocalNet(), ...fixtureConfig }\n }\n\n const algod = fixtureConfig.algod ?? ClientManager.getAlgodClient(fixtureConfig.algodConfig!)\n const indexer = fixtureConfig.indexer ?? ClientManager.getIndexerClient(fixtureConfig.indexerConfig!)\n const kmd = fixtureConfig.kmd ?? ClientManager.getKmdClient(fixtureConfig.kmdConfig!)\n let context: AlgorandTestAutomationContext\n let algorand: AlgorandClient\n\n const beforeEach = async () => {\n Config.configure({ debug: true })\n const transactionLogger = new TransactionLogger()\n const transactionLoggerAlgod = transactionLogger.capture(algod)\n algorand = AlgorandClient.fromClients({ algod: transactionLoggerAlgod, indexer, kmd })\n const acc = await getTestAccount({ initialFunds: fixtureConfig?.testAccountFunding ?? algos(10), suppressLog: true }, algorand)\n algorand.setSignerFromAccount(acc).setSuggestedParamsTimeout(0)\n // If running against LocalNet we are likely in dev mode and we need to set a much higher validity window\n // otherwise we are more likely to get invalid transactions.\n if (await algorand.client.isLocalNet()) {\n algorand.setDefaultValidityWindow(1000)\n }\n const testAccount = { ...acc, signer: algorand.account.getSigner(acc.addr) }\n context = {\n algorand,\n algod: transactionLoggerAlgod,\n indexer: indexer,\n kmd: kmd,\n testAccount,\n generateAccount: async (params: GetTestAccountParams) => {\n const account = await getTestAccount(params, algorand)\n algorand.setSignerFromAccount(account)\n return { ...account, signer: algorand.account.getSigner(account.addr) }\n },\n transactionLogger: transactionLogger,\n waitForIndexer: () => transactionLogger.waitForIndexer(indexer),\n waitForIndexerTransaction: (transactionId: string) => runWhenIndexerCaughtUp(() => lookupTransactionById(transactionId, indexer)),\n }\n }\n\n return {\n get context() {\n return context\n },\n get algorand() {\n return algorand\n },\n beforeEach,\n }\n}\n"],"names":["config","ClientManager","indexer","Config","transactionLogger","TransactionLogger","AlgorandClient","getTestAccount","algos","account","runWhenIndexerCaughtUp","lookupTransactionById"],"mappings":";;;;;;;;;;;AA4EgB,SAAA,eAAe,CAAC,aAAqC,EAAEA,QAAmB,EAAA;IACxF,aAAa,GAAG,EAAE,GAAG,aAAa,EAAE,GAAGA,QAAM,EAAE,CAAA;AAC/C,IAAA,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,aAAa,CAAC,OAAO,IAAI,C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CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAA;SACxC;AACD,QAAA,MAAM,WAAW,GAAG,EAAE,GAAG,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAA;AAC5E,QAAA,OAAO,GAAG;YACR,QAAQ;AACR,YAAA,KAAK,EAAE,sBAAsB;AAC7B,YAAA,OAAO,EAAEN,SAAO;AAChB,YAAA,GAAG,EAAE,GAAG;YACR,WAAW;AACX,YAAA,eAAe,EAAE,OAAO,MAA4B,KAAI;gBACtD,MAAMO,SAAO,GAAG,MAAMF,sBAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AACtD,gBAAA,QAAQ,CAAC,oBAAoB,CAACE,SAAO,CAAC,CAAA;AACtC,gBAAA,OAAO,EAAE,GAAGA,SAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,CAACA,SAAO,CAAC,IAAI,CAAC,EAAE,CAAA;aACxE;AACD,YAAA,iBAAiB,EAAEL,mBAAiB;YACpC,cAAc,EAAE,MAAMA,mBAAiB,CAAC,cAAc,CAACF,SAAO,CAAC;AAC/D,YAAA,yBAAyB,EAAE,CAAC,aAAqB,KAAKQ,8BAAsB,CAAC,MAAMC,mCAAqB,CAAC,aAAa,EAAET,SAAO,CAAC,CAAC;SAClI,CAAA;AACH,KAAC,CAAA;IAED,OAAO;AACL,QAAA,IAAI,OAAO,GAAA;AACT,YAAA,OAAO,OAAO,CAAA;SACf;AACD,QAAA,IAAI,QAAQ,GAAA;AACV,YAAA,OAAO,QAAQ,CAAA;SAChB;QACD,UAAU;KACX,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"algorand-fixture.js","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"sourcesContent":["import { algos, Config, lookupTransactionById } from '../../'\nimport AlgorandClient from '../../types/algorand-client'\nimport { ClientManager } from '../../types/client-manager'\nimport { AlgoConfig } from '../../types/network-client'\nimport { AlgorandFixture, AlgorandFixtureConfig, AlgorandTestAutomationContext, GetTestAccountParams } from '../../types/testing'\nimport { getTestAccount } from '../account'\nimport { runWhenIndexerCaughtUp } from '../indexer'\nimport { TransactionLogger } from '../transaction-logger'\n\n/**\n * Creates a test fixture for automated testing against Algorand.\n * By default it tests against an environment variable specified client\n * if the standard environment variables are specified, otherwise against\n * a default LocalNet instance, but you can pass in an algod, indexer\n * and/or kmd (or their respective config) if you want to test against\n * an explicitly defined network.\n *\n * @example No config\n * ```typescript\n * const algorand = algorandFixture()\n *\n * beforeEach(algorand.beforeEach, 10_000)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = algorand.context\n * // test things...\n * })\n * ```\n *\n * @example With config\n * ```typescript\n * const algorand = algorandFixture({\n * algod: new Algodv2('localhost', 12345, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),\n * // ...\n * })\n *\n * beforeEach(algorand.beforeEach, 10_000)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = algorand.context\n * // test things...\n * })\n * ```\n *\n * @param fixtureConfig The fixture configuration\n * @returns The fixture\n */\nexport function algorandFixture(fixtureConfig?: AlgorandFixtureConfig): AlgorandFixture\n\n/**\n * @deprecated Config can be passed in directly to fixture config now.\n *\n * Creates a test fixture for automated testing against Algorand.\n * By default it tests against an environment variable specified client\n * if the standard environment variables are specified, otherwise against\n * a default LocalNet instance, but you can pass in an algod, indexer\n * and/or kmd if you want to test against an explicitly defined network.\n *\n * @example\n * ```typescript\n * const algorand = algorandFixture(undefined, getConfigFromEnvOrDefaults())\n *\n * beforeEach(algorand.beforeEach, 10_000)\n *\n * test('My test', async () => {\n * const {algod, indexer, testAccount, ...} = algorand.context\n * // test things...\n * })\n * ```\n *\n * @param fixtureConfig The fixture configuration\n * @param config The fixture configuration\n * @returns The fixture\n */\nexport function algorandFixture(fixtureConfig: AlgorandFixtureConfig | undefined, config: AlgoConfig): AlgorandFixture\n\nexport function algorandFixture(fixtureConfig?: AlgorandFixtureConfig, config?: AlgoConfig): AlgorandFixture {\n fixtureConfig = { ...fixtureConfig, ...config }\n if (!fixtureConfig.algod || !fixtureConfig.indexer || !fixtureConfig.kmd) {\n fixtureConfig = { ...ClientManager.getConfigFromEnvironmentOrLocalNet(), ...fixtureConfig }\n }\n\n const algod = fixtureConfig.algod ?? ClientManager.getAlgodClient(fixtureConfig.algodConfig!)\n const indexer = fixtureConfig.indexer ?? ClientManager.getIndexerClient(fixtureConfig.indexerConfig!)\n const kmd = fixtureConfig.kmd ?? ClientManager.getKmdClient(fixtureConfig.kmdConfig!)\n let context: AlgorandTestAutomationContext\n let algorand: AlgorandClient\n\n const beforeEach = async () => {\n Config.configure({ debug: true })\n const transactionLogger = new TransactionLogger()\n const transactionLoggerAlgod = transactionLogger.capture(algod)\n algorand = AlgorandClient.fromClients({ algod: transactionLoggerAlgod, indexer, kmd })\n const acc = await getTestAccount({ initialFunds: fixtureConfig?.testAccountFunding ?? algos(10), suppressLog: true }, algorand)\n algorand.setSignerFromAccount(acc).setSuggestedParamsCacheTimeout(0)\n // If running against LocalNet we are likely in dev mode and we need to set a much higher validity window\n // otherwise we are more likely to get invalid transactions.\n if (await algorand.client.isLocalNet()) {\n algorand.setDefaultValidityWindow(1000)\n }\n const testAccount = { ...acc, signer: algorand.account.getSigner(acc.addr) }\n context = {\n algorand,\n algod: transactionLoggerAlgod,\n indexer: indexer,\n kmd: kmd,\n testAccount,\n generateAccount: async (params: GetTestAccountParams) => {\n const account = await getTestAccount(params, algorand)\n algorand.setSignerFromAccount(account)\n return { ...account, signer: algorand.account.getSigner(account.addr) }\n },\n transactionLogger: transactionLogger,\n waitForIndexer: () => transactionLogger.waitForIndexer(indexer),\n waitForIndexerTransaction: (transactionId: string) => runWhenIndexerCaughtUp(() => lookupTransactionById(transactionId, indexer)),\n }\n }\n\n return {\n get context() {\n return context\n },\n get algorand() {\n return algorand\n },\n beforeEach,\n }\n}\n"],"names":["config","ClientManager","indexer","Config","transactionLogger","TransactionLogger","AlgorandClient","getTestAccount","algos","account","runWhenIndexerCaughtUp","lookupTransactionById"],"mappings":";;;;;;;;;;;AA4EgB,SAAA,eAAe,CAAC,aAAqC,EAAEA,QAAmB,EAAA;IACxF,aAAa,GAAG,EAAE,GAAG,aAAa,EAAE,GAAGA,QAAM,EAAE,CAAA;AAC/C,IAAA,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE;QACxE,aAAa,GAAG,EAAE,GAAGC,iCAAa,CAAC,kCAAkC,EAAE,EAAE,GAAG,aAAa,EAAE,CAAA;KAC5F;AAED,IAAA,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,IAAIA,iCAAa,CAAC,cAAc,CAAC,aAAa,CAAC,WAAY,CAAC,CAAA;AAC7F,IAAA,MAAMC,SAAO,GAAG,aAAa,CAAC,OAAO,IAAID,iCAAa,CAAC,gBAAgB,CAAC,aAAa,CAAC,aAAc,CAAC,CAAA;AACrG,IAAA,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,IAAIA,iCAAa,CAAC,YAAY,CAAC,aAAa,CAAC,SAAU,CAAC,CAAA;AACrF,IAAA,IAAI,OAAsC,CAAA;AAC1C,IAAA,IAAI,QAAwB,CAAA;AAE5B,IAAA,MAAM,UAAU,GAAG,YAAW;QAC5BE,aAAM,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;AACjC,QAAA,MAAMC,mBAAiB,GAAG,IAAIC,mCAAiB,EAAE,CAAA;QACjD,MAAM,sBAAsB,GAAGD,mBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC/D,QAAA,QAAQ,GAAGE,mCAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,sBAAsB,WAAEJ,SAAO,EAAE,GAAG,EAAE,CAAC,CAAA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O;AACL,QAAA,IAAI,OAAO,GAAA;AACT,YAAA,OAAO,OAAO,CAAA;SACf;AACD,QAAA,IAAI,QAAQ,GAAA;AACV,YAAA,OAAO,QAAQ,CAAA;SAChB;QACD,UAAU;KACX,CAAA;AACH;;;;"}
@@ -23,7 +23,7 @@ function algorandFixture(fixtureConfig, config) {
23
23
  const transactionLoggerAlgod = transactionLogger.capture(algod);
24
24
  algorand = AlgorandClient.fromClients({ algod: transactionLoggerAlgod, indexer, kmd });
25
25
  const acc = await getTestAccount({ initialFunds: fixtureConfig?.testAccountFunding ?? algos(10), suppressLog: true }, algorand);
26
- algorand.setSignerFromAccount(acc).setSuggestedParamsTimeout(0);
26
+ algorand.setSignerFromAccount(acc).setSuggestedParamsCacheTimeout(0);
27
27
  // If running against LocalNet we are likely in dev mode and we need to set a much higher validity window
28
28
  // otherwise we are more likely to get invalid transactions.
29
29
  if (await algorand.client.isLocalNet()) {