Skip to content

Commit f97ac64

Browse files
committed
chore: update to latest algosdk
1 parent 5e23672 commit f97ac64

File tree

4 files changed

+40
-71
lines changed

4 files changed

+40
-71
lines changed

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"buffer": "^6.0.3"
6161
},
6262
"peerDependencies": {
63-
"algosdk": "^3.5.0"
63+
"algosdk": "^3.5.1"
6464
},
6565
"devDependencies": {
6666
"@algorandfoundation/tealscript": "^0.106.3",
@@ -75,7 +75,7 @@
7575
"@types/uuid": "^10.0.0",
7676
"@typescript-eslint/eslint-plugin": "^8.8.1",
7777
"@vitest/coverage-v8": "^2.1.2",
78-
"algosdk": "^3.5.0",
78+
"algosdk": "^3.5.1",
7979
"better-npm-audit": "^3.11.0",
8080
"conventional-changelog-conventionalcommits": "8.0.0",
8181
"cpy-cli": "^5.0.0",

src/transaction/transaction.spec.ts

Lines changed: 32 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import algosdk, { ABIAddressType, ABIMethod, ABIType, Account, Address } from 'algosdk'
1+
import algosdk, { ABIMethod, ABIType, Account, Address } from 'algosdk'
22
import invariant from 'tiny-invariant'
33
import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'vitest'
44
import { APP_SPEC as nestedContractAppSpec } from '../../tests/example-contracts/client/TestContractClient'
@@ -1181,7 +1181,6 @@ describe('abi return', () => {
11811181
})
11821182
})
11831183

1184-
// TODO: NC - Switch these tests to not use bare.send(...) once algosdk supports access references
11851184
describe('access references', () => {
11861185
const fixture = algorandFixture()
11871186
beforeEach(fixture.newScope)
@@ -1251,52 +1250,38 @@ describe('access references', () => {
12511250
}, 20_000) // Account generation and funding can be slow
12521251

12531252
test('address reference enables access', async () => {
1254-
const alice = await fixture.context.generateAccount({ initialFunds: AlgoAmount.Algo(0.1) })
1255-
1256-
const method = appClient.getABIMethod('addressBalance').getSelector()
1257-
1258-
const addressType = new ABIAddressType()
1259-
const aliceAddr = addressType.encode(alice)
1260-
1261-
await appClient.send.bare.call({ args: [method, aliceAddr], populateAppCallResources: false, accessReferences: [{ address: alice }] })
1253+
await appClient.send.call({
1254+
method: 'addressBalance',
1255+
args: [alice],
1256+
populateAppCallResources: false,
1257+
accessReferences: [{ address: alice }],
1258+
})
12621259
})
12631260

12641261
test('up to 8 non access reference accounts can be used', async () => {
1265-
const method = appClient.getABIMethod('addressBalance').getSelector()
1266-
1267-
const addressType = new ABIAddressType()
1268-
const aliceAddr = addressType.encode(alice)
1269-
1270-
await appClient.send.bare.call({
1271-
args: [method, aliceAddr],
1262+
await appClient.send.call({
1263+
method: 'addressBalance',
1264+
args: [alice],
12721265
populateAppCallResources: false,
12731266
accountReferences: [alice, bob, charlie, dan, eve, frank, grace, heidi],
12741267
})
12751268
})
12761269

12771270
test('throws when more than 8 non access reference accounts are supplied', async () => {
1278-
const method = appClient.getABIMethod('addressBalance').getSelector()
1279-
1280-
const addressType = new ABIAddressType()
1281-
const aliceAddr = addressType.encode(alice)
1282-
12831271
await expect(
1284-
appClient.send.bare.call({
1285-
args: [method, aliceAddr],
1272+
appClient.send.call({
1273+
method: 'addressBalance',
1274+
args: [alice],
12861275
populateAppCallResources: false,
12871276
accountReferences: [alice, bob, charlie, dan, eve, frank, grace, heidi, ivan],
12881277
}),
12891278
).rejects.toThrow(/max number of accounts is 8/)
12901279
})
12911280

12921281
test('up to 16 access addresses can be used', async () => {
1293-
const method = appClient.getABIMethod('addressBalance').getSelector()
1294-
1295-
const addressType = new ABIAddressType()
1296-
const aliceAddr = addressType.encode(alice)
1297-
1298-
await appClient.send.bare.call({
1299-
args: [method, aliceAddr],
1282+
await appClient.send.call({
1283+
method: 'addressBalance',
1284+
args: [alice],
13001285
populateAppCallResources: false,
13011286
accessReferences: [
13021287
{ address: alice },
@@ -1320,14 +1305,10 @@ describe('access references', () => {
13201305
})
13211306

13221307
test('throws when more than 16 access addresses are supplied', async () => {
1323-
const method = appClient.getABIMethod('addressBalance').getSelector()
1324-
1325-
const addressType = new ABIAddressType()
1326-
const aliceAddr = addressType.encode(alice)
1327-
13281308
await expect(
1329-
appClient.send.bare.call({
1330-
args: [method, aliceAddr],
1309+
appClient.send.call({
1310+
method: 'addressBalance',
1311+
args: [alice],
13311312
populateAppCallResources: false,
13321313
accessReferences: [
13331314
{ address: alice },
@@ -1353,32 +1334,28 @@ describe('access references', () => {
13531334
})
13541335

13551336
test('app reference enables access', async () => {
1356-
const method = appClient.getABIMethod('externalAppCall').getSelector()
1357-
1358-
await appClient.send.bare.call({
1359-
args: [method],
1337+
await appClient.send.call({
1338+
method: 'externalAppCall',
13601339
populateAppCallResources: false,
13611340
accessReferences: [{ appId: externalClient.appId }],
13621341
staticFee: microAlgo(2000),
13631342
})
13641343
})
13651344

13661345
test('asset reference enables access', async () => {
1367-
const method = appClient.getABIMethod('assetTotal').getSelector()
13681346
const assetId = (await appClient.getGlobalState()).asa.value as bigint
13691347

1370-
await appClient.send.bare.call({
1371-
args: [method],
1348+
await appClient.send.call({
1349+
method: 'assetTotal',
13721350
populateAppCallResources: false,
13731351
accessReferences: [{ assetId }],
13741352
})
13751353
})
13761354

13771355
test('box reference enables access', async () => {
1378-
const method = appClient.getABIMethod('smallBox').getSelector()
1379-
1380-
await appClient.send.bare.call({
1381-
args: [method],
1356+
await appClient.send.call({
1357+
method: 'smallBox',
1358+
args: [],
13821359
populateAppCallResources: false,
13831360
accessReferences: [{ box: { appId: appClient.appId, name: new Uint8Array([115]) } }],
13841361
})
@@ -1388,13 +1365,9 @@ describe('access references', () => {
13881365
const alice = await fixture.context.generateAccount({ initialFunds: AlgoAmount.Algo(0.1) })
13891366
const assetId = (await appClient.getGlobalState()).asa.value as bigint
13901367

1391-
const method = appClient.getABIMethod('hasAsset').getSelector()
1392-
1393-
const addressType = new ABIAddressType()
1394-
const aliceAddr = addressType.encode(alice)
1395-
1396-
await appClient.send.bare.call({
1397-
args: [method, aliceAddr],
1368+
await appClient.send.call({
1369+
method: 'hasAsset',
1370+
args: [alice],
13981371
populateAppCallResources: false,
13991372
accessReferences: [{ holding: { address: alice, assetId } }],
14001373
})
@@ -1406,13 +1379,9 @@ describe('access references', () => {
14061379
// Opt alice into the external app
14071380
await fixture.algorand.send.appCallMethodCall(await externalClient.params.optIn({ method: 'optInToApplication', sender: alice }))
14081381

1409-
const method = appClient.getABIMethod('externalLocal').getSelector()
1410-
1411-
const addressType = new ABIAddressType()
1412-
const aliceAddr = addressType.encode(alice)
1413-
1414-
await appClient.send.bare.call({
1415-
args: [method, aliceAddr],
1382+
await appClient.send.call({
1383+
method: 'externalLocal',
1384+
args: [alice],
14161385
populateAppCallResources: false,
14171386
accessReferences: [{ locals: { address: alice, appId: externalClient.appId } }],
14181387
})

src/types/composer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ export class TransactionComposer {
16361636
appForeignApps: params.appReferences?.map((x) => Number(x)),
16371637
appForeignAssets: params.assetReferences?.map((x) => Number(x)),
16381638
boxes: params.boxReferences?.map(AppManager.getBoxReference),
1639-
access: params.accessReferences?.map(getAccessReference), // TODO: NC - This is currently not supported in algosdk
1639+
access: params.accessReferences?.map(getAccessReference),
16401640
approvalProgram,
16411641
clearProgram: clearStateProgram,
16421642
extraPages:

0 commit comments

Comments
 (0)