Skip to content

Commit 25de024

Browse files
committed
chore: update to latest algosdk
1 parent 291f891 commit 25de024

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'
@@ -1161,7 +1161,6 @@ describe('abi return', () => {
11611161
})
11621162
})
11631163

1164-
// TODO: NC - Switch these tests to not use bare.send(...) once algosdk supports access references
11651164
describe('access references', () => {
11661165
const fixture = algorandFixture()
11671166
beforeEach(fixture.newScope)
@@ -1231,52 +1230,38 @@ describe('access references', () => {
12311230
}, 20_000) // Account generation and funding can be slow
12321231

12331232
test('address reference enables access', async () => {
1234-
const alice = await fixture.context.generateAccount({ initialFunds: AlgoAmount.Algo(0.1) })
1235-
1236-
const method = appClient.getABIMethod('addressBalance').getSelector()
1237-
1238-
const addressType = new ABIAddressType()
1239-
const aliceAddr = addressType.encode(alice)
1240-
1241-
await appClient.send.bare.call({ args: [method, aliceAddr], populateAppCallResources: false, accessReferences: [{ address: alice }] })
1233+
await appClient.send.call({
1234+
method: 'addressBalance',
1235+
args: [alice],
1236+
populateAppCallResources: false,
1237+
accessReferences: [{ address: alice }],
1238+
})
12421239
})
12431240

12441241
test('up to 8 non access reference accounts can be used', async () => {
1245-
const method = appClient.getABIMethod('addressBalance').getSelector()
1246-
1247-
const addressType = new ABIAddressType()
1248-
const aliceAddr = addressType.encode(alice)
1249-
1250-
await appClient.send.bare.call({
1251-
args: [method, aliceAddr],
1242+
await appClient.send.call({
1243+
method: 'addressBalance',
1244+
args: [alice],
12521245
populateAppCallResources: false,
12531246
accountReferences: [alice, bob, charlie, dan, eve, frank, grace, heidi],
12541247
})
12551248
})
12561249

12571250
test('throws when more than 8 non access reference accounts are supplied', async () => {
1258-
const method = appClient.getABIMethod('addressBalance').getSelector()
1259-
1260-
const addressType = new ABIAddressType()
1261-
const aliceAddr = addressType.encode(alice)
1262-
12631251
await expect(
1264-
appClient.send.bare.call({
1265-
args: [method, aliceAddr],
1252+
appClient.send.call({
1253+
method: 'addressBalance',
1254+
args: [alice],
12661255
populateAppCallResources: false,
12671256
accountReferences: [alice, bob, charlie, dan, eve, frank, grace, heidi, ivan],
12681257
}),
12691258
).rejects.toThrow(/max number of accounts is 8/)
12701259
})
12711260

12721261
test('up to 16 access addresses can be used', async () => {
1273-
const method = appClient.getABIMethod('addressBalance').getSelector()
1274-
1275-
const addressType = new ABIAddressType()
1276-
const aliceAddr = addressType.encode(alice)
1277-
1278-
await appClient.send.bare.call({
1279-
args: [method, aliceAddr],
1262+
await appClient.send.call({
1263+
method: 'addressBalance',
1264+
args: [alice],
12801265
populateAppCallResources: false,
12811266
accessReferences: [
12821267
{ address: alice },
@@ -1300,14 +1285,10 @@ describe('access references', () => {
13001285
})
13011286

13021287
test('throws when more than 16 access addresses are supplied', async () => {
1303-
const method = appClient.getABIMethod('addressBalance').getSelector()
1304-
1305-
const addressType = new ABIAddressType()
1306-
const aliceAddr = addressType.encode(alice)
1307-
13081288
await expect(
1309-
appClient.send.bare.call({
1310-
args: [method, aliceAddr],
1289+
appClient.send.call({
1290+
method: 'addressBalance',
1291+
args: [alice],
13111292
populateAppCallResources: false,
13121293
accessReferences: [
13131294
{ address: alice },
@@ -1333,32 +1314,28 @@ describe('access references', () => {
13331314
})
13341315

13351316
test('app reference enables access', async () => {
1336-
const method = appClient.getABIMethod('externalAppCall').getSelector()
1337-
1338-
await appClient.send.bare.call({
1339-
args: [method],
1317+
await appClient.send.call({
1318+
method: 'externalAppCall',
13401319
populateAppCallResources: false,
13411320
accessReferences: [{ appId: externalClient.appId }],
13421321
staticFee: microAlgo(2000),
13431322
})
13441323
})
13451324

13461325
test('asset reference enables access', async () => {
1347-
const method = appClient.getABIMethod('assetTotal').getSelector()
13481326
const assetId = (await appClient.getGlobalState()).asa.value as bigint
13491327

1350-
await appClient.send.bare.call({
1351-
args: [method],
1328+
await appClient.send.call({
1329+
method: 'assetTotal',
13521330
populateAppCallResources: false,
13531331
accessReferences: [{ assetId }],
13541332
})
13551333
})
13561334

13571335
test('box reference enables access', async () => {
1358-
const method = appClient.getABIMethod('smallBox').getSelector()
1359-
1360-
await appClient.send.bare.call({
1361-
args: [method],
1336+
await appClient.send.call({
1337+
method: 'smallBox',
1338+
args: [],
13621339
populateAppCallResources: false,
13631340
accessReferences: [{ box: { appId: appClient.appId, name: new Uint8Array([115]) } }],
13641341
})
@@ -1368,13 +1345,9 @@ describe('access references', () => {
13681345
const alice = await fixture.context.generateAccount({ initialFunds: AlgoAmount.Algo(0.1) })
13691346
const assetId = (await appClient.getGlobalState()).asa.value as bigint
13701347

1371-
const method = appClient.getABIMethod('hasAsset').getSelector()
1372-
1373-
const addressType = new ABIAddressType()
1374-
const aliceAddr = addressType.encode(alice)
1375-
1376-
await appClient.send.bare.call({
1377-
args: [method, aliceAddr],
1348+
await appClient.send.call({
1349+
method: 'hasAsset',
1350+
args: [alice],
13781351
populateAppCallResources: false,
13791352
accessReferences: [{ holding: { address: alice, assetId } }],
13801353
})
@@ -1386,13 +1359,9 @@ describe('access references', () => {
13861359
// Opt alice into the external app
13871360
await fixture.algorand.send.appCallMethodCall(await externalClient.params.optIn({ method: 'optInToApplication', sender: alice }))
13881361

1389-
const method = appClient.getABIMethod('externalLocal').getSelector()
1390-
1391-
const addressType = new ABIAddressType()
1392-
const aliceAddr = addressType.encode(alice)
1393-
1394-
await appClient.send.bare.call({
1395-
args: [method, aliceAddr],
1362+
await appClient.send.call({
1363+
method: 'externalLocal',
1364+
args: [alice],
13961365
populateAppCallResources: false,
13971366
accessReferences: [{ locals: { address: alice, appId: externalClient.appId } }],
13981367
})

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)