Skip to content

Commit b31187f

Browse files
committed
Merge branch 'release/v1.18.0'
2 parents cfd5b88 + 633f19b commit b31187f

File tree

12 files changed

+177
-64
lines changed

12 files changed

+177
-64
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# v1.18.0
2+
3+
## What's Changed
4+
5+
- Add method to abi results by @barnjamin in https://github.com/algorand/js-algorand-sdk/pull/578
6+
- Add getMethodByName function to Contract and Interface by @barnjamin in https://github.com/algorand/js-algorand-sdk/pull/583
7+
18
# v1.17.0
29

310
## What's Changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
unit:
2-
node_modules/.bin/cucumber-js --tags "@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.keyreg or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.atomic_transaction_composer or @unit.responses.unlimited_assets or @unit.indexer.ledger_refactoring or @unit.algod.ledger_refactoring or @unit.dryrun.trace.application" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js
2+
node_modules/.bin/cucumber-js --tags "@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.transactions.keyreg or @unit.transactions.payment or @unit.responses.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.abijson.byname or @unit.atomic_transaction_composer or @unit.responses.unlimited_assets or @unit.indexer.ledger_refactoring or @unit.algod.ledger_refactoring or @unit.dryrun.trace.application" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js
33

44
integration:
55
node_modules/.bin/cucumber-js --tags "@algod or @assets or @auction or @kmd or @send or @indexer or @rekey or @send.keyregtxn or @dryrun or @compile or @applications or @indexer.applications or @applications.verified or @indexer.231 or @abi or @c2c" tests/cucumber/features --require-module ts-node/register --require tests/cucumber/steps/index.js

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Include a minified browser bundle directly in your HTML like so:
2222

2323
```html
2424
<script
25-
src="https://unpkg.com/algosdk@v1.17.0/dist/browser/algosdk.min.js"
26-
integrity="sha384-a9B05lyY5P6hDuZRdqWCEOD7xn/qAY8gc4B5/SJwy+t8GcUlwpzJ25qHcYwxi1NX"
25+
src="https://unpkg.com/algosdk@v1.18.0/dist/browser/algosdk.min.js"
26+
integrity="sha384-sUsnfiP7rGkgddTfqUUdb66b2cVxVmYkCyrJBCcWWSmpccI73Vm9wkUrCLsEcG6f"
2727
crossorigin="anonymous"
2828
></script>
2929
```
@@ -32,8 +32,8 @@ or
3232

3333
```html
3434
<script
35-
src="https://cdn.jsdelivr.net/npm/algosdk@v1.17.0/dist/browser/algosdk.min.js"
36-
integrity="sha384-a9B05lyY5P6hDuZRdqWCEOD7xn/qAY8gc4B5/SJwy+t8GcUlwpzJ25qHcYwxi1NX"
35+
src="https://cdn.jsdelivr.net/npm/algosdk@v1.18.0/dist/browser/algosdk.min.js"
36+
integrity="sha384-sUsnfiP7rGkgddTfqUUdb66b2cVxVmYkCyrJBCcWWSmpccI73Vm9wkUrCLsEcG6f"
3737
crossorigin="anonymous"
3838
></script>
3939
```

package-lock.json

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "algosdk",
3-
"version": "1.17.0",
3+
"version": "1.18.0",
44
"description": "The official JavaScript SDK for Algorand",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",
@@ -47,15 +47,15 @@
4747
"eslint-plugin-import": "^2.22.1",
4848
"eslint-plugin-tsdoc": "^0.2.11",
4949
"express": "^4.17.1",
50-
"geckodriver": "^2.0.0",
50+
"geckodriver": "^3.0.1",
5151
"husky": "^4.3.8",
5252
"lint-staged": "^10.5.4",
5353
"mocha": "^9.0.0",
5454
"mocha-lcov-reporter": "^1.3.0",
5555
"mock-http-server": "^1.4.3",
5656
"path-browserify": "^1.0.1",
5757
"prettier": "2.2.1",
58-
"selenium-webdriver": "^4.0.0-beta.4",
58+
"selenium-webdriver": "^4.2.0",
5959
"source-map-loader": "^2.0.2",
6060
"ts-loader": "^8.3.0",
6161
"ts-node": "^10.0.0",

src/abi/contract.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ABIMethod, ABIMethodParams } from './method';
1+
import { ABIMethod, ABIMethodParams, getMethodByName } from './method';
22

33
export interface ABIContractNetworkInfo {
44
appID: number;
@@ -44,4 +44,8 @@ export class ABIContract {
4444
methods: this.methods.map((method) => method.toJSON()),
4545
};
4646
}
47+
48+
getMethodByName(name: string): ABIMethod {
49+
return getMethodByName(this.methods, name);
50+
}
4751
}

src/abi/interface.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ABIMethod, ABIMethodParams } from './method';
1+
import { ABIMethod, ABIMethodParams, getMethodByName } from './method';
22

33
export interface ABIInterfaceParams {
44
name: string;
@@ -28,4 +28,8 @@ export class ABIInterface {
2828
methods: this.methods.map((method) => method.toJSON()),
2929
};
3030
}
31+
32+
getMethodByName(name: string): ABIMethod {
33+
return getMethodByName(this.methods, name);
34+
}
3135
}

src/abi/method.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,27 @@ export class ABIMethod {
160160
});
161161
}
162162
}
163+
164+
export function getMethodByName(methods: ABIMethod[], name: string): ABIMethod {
165+
if (
166+
methods === null ||
167+
!Array.isArray(methods) ||
168+
!methods.every((item) => item instanceof ABIMethod)
169+
)
170+
throw new Error('Methods list provided is null or not the correct type');
171+
172+
const filteredMethods = methods.filter((m: ABIMethod) => m.name === name);
173+
if (filteredMethods.length > 1)
174+
throw new Error(
175+
`found ${
176+
filteredMethods.length
177+
} methods with the same name ${filteredMethods
178+
.map((m: ABIMethod) => m.getSignature())
179+
.join(',')}`
180+
);
181+
182+
if (filteredMethods.length === 0)
183+
throw new Error(`found 0 methods with the name ${name}`);
184+
185+
return filteredMethods[0];
186+
}

src/composer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ export interface ABIResult {
4242
* does not return a value (return type "void").
4343
*/
4444
rawReturnValue: Uint8Array;
45+
/**
46+
* The method that was called for this result
47+
*/
48+
method: ABIMethod;
4549
/**
4650
* The return value from the ABI method call. This will be undefined if the method does not return
4751
* a value (return type "void"), or if the SDK was unable to decode the returned value.
@@ -632,6 +636,7 @@ export class AtomicTransactionComposer {
632636
const methodResult: ABIResult = {
633637
txID,
634638
rawReturnValue: new Uint8Array(),
639+
method,
635640
};
636641

637642
try {

tests/cucumber/steps/index.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,19 @@ if (browser) {
2626
const chrome = require('selenium-webdriver/chrome');
2727
const firefox = require('selenium-webdriver/firefox');
2828

29-
const chromeOptions = new chrome.Options();
30-
const firefoxOptions = new firefox.Options();
29+
let chromeOptions = new chrome.Options();
30+
let firefoxOptions = new firefox.Options();
3131

3232
if (process.env.CI) {
33-
chromeOptions.addArguments('--no-sandbox', '--headless', '--disable-gpu');
34-
firefoxOptions.addArguments('-headless');
33+
chromeOptions = chromeOptions.addArguments(
34+
'no-sandbox',
35+
'disable-gpu',
36+
'headless'
37+
);
38+
firefoxOptions = firefoxOptions
39+
.setPreference('remote.active-protocols', 1) // Sets protocol to only WebDriver BiDi
40+
.setPreference('network.http.network-changed.timeout', 30) // In Docker tests this apparently matters
41+
.headless();
3542
}
3643

3744
driverBuilder = new webdriver.Builder()

0 commit comments

Comments
 (0)