Skip to content

Commit cbda04a

Browse files
Merge pull request #955 from ProvableHQ/feat/add-sdk-0.8.0-changes-to-provable-dot-tools
[Feature] Add sdk 0.8.0 changes to provable dot tools
2 parents 25a333d + f403298 commit cbda04a

File tree

15 files changed

+1308
-139
lines changed

15 files changed

+1308
-139
lines changed

create-leo-app/template-react-leo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"install-leo": "./install.sh"
1313
},
1414
"dependencies": {
15-
"@provablehq/sdk": "^0.7.0",
15+
"@provablehq/sdk": "^0.8.0",
1616
"comlink": "^4.4.1",
1717
"react": "^18.2.0",
1818
"react-dom": "^18.2.0"

sdk/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@provablehq/sdk",
3-
"version": "0.7.6",
3+
"version": "0.8.0",
44
"description": "A Software Development Kit (SDK) for Zero-Knowledge Transactions",
55
"collaborators": [
66
"The Provable Team"
@@ -47,7 +47,7 @@
4747
},
4848
"homepage": "https://github.com/ProvableHQ/sdk#readme",
4949
"dependencies": {
50-
"@provablehq/wasm": "^0.7.6",
50+
"@provablehq/wasm": "^0.8.0",
5151
"comlink": "^4.4.1",
5252
"core-js": "^3.38.1",
5353
"mime": "^3.0.0",

sdk/tests/network-client.test.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@ async function expectThrows(f: () => Promise<any>): Promise<void> {
3535

3636
describe('NodeConnection', () => {
3737
let connection: AleoNetworkClient;
38+
let network: string;
3839
let windowFetchSpy: sinon.SinonSpy;
3940

4041
beforeEach(() => {
4142
connection = new AleoNetworkClient("https://api.explorer.provable.com/v1");
43+
if (connection.host === "https://api.explorer.provable.com/v1/testnet") {
44+
network = "testnet";
45+
} else {
46+
network = "mainnet";
47+
}
4248
windowFetchSpy = sinon.spy(globalThis, 'fetch');
4349
});
4450

@@ -237,8 +243,7 @@ describe('NodeConnection', () => {
237243

238244
describe('Test API methods that return wasm objects', () => {
239245
it('Plaintext returned from the API should have expected properties', async () => {
240-
const transactions = await connection.getTransactions(27400);
241-
if (transactions.length > 0) {
246+
if (network === "testnet") {
242247
// Check a struct variant of a plaintext object.
243248
let plaintext = await connection.getProgramMappingPlaintext("credits.aleo", "committee", "aleo17m3l8a4hmf3wypzkf5lsausfdwq9etzyujd0vmqh35ledn2sgvqqzqkqal");
244249
expect(plaintext.plaintextType()).equal("struct");
@@ -259,8 +264,7 @@ describe('NodeConnection', () => {
259264

260265
it('should have correct data within the wasm object and summary object for an execution transaction', async () => {
261266
// Get the first transaction at block 24700 on testnet.
262-
const transactions = await connection.getTransactions(27400);
263-
if (transactions.length > 0) {
267+
if (network === "testnet") {
264268
const transaction = await connection.getTransactionObject("at1fjy6s9md2v4rgcn3j3q4qndtfaa2zvg58a4uha0rujvrn4cumu9qfazxdd");
265269
const transition = <Transition>transaction.transitions()[0];
266270
const summary = <TransactionObject>transaction.summary(true);
@@ -325,8 +329,7 @@ describe('NodeConnection', () => {
325329

326330
it('should have correct data within the wasm object and summary object for a deployment transaction', async () => {
327331
// Get the deployment transaction for token_registry.aleo
328-
const transactions = await connection.getTransactions(27400);
329-
if (transactions.length === 0) {
332+
if (network === "mainnet") {
330333
const transaction = await connection.getTransactionObject("at15mwg0jyhvpjjrfxwrlwzn8puusnmy7r3xzvpjht4e5gzgnp68q9qd0qqec");
331334
const summary = <TransactionObject>transaction.summary(true);
332335
const deployment = <DeploymentObject>summary.deployment;
@@ -352,8 +355,8 @@ describe('NodeConnection', () => {
352355
});
353356

354357
it('Should give the correct JSON response when requesting multiple transactions', async () => {
355-
const transactions = await connection.getTransactions(27400);
356-
if (transactions.length > 0) {
358+
if (network === "testnet") {
359+
const transactions = await connection.getTransactions(27400);
357360
expect(transactions.length).equal(4);
358361
expect(transactions[0].status).equal("accepted");
359362
expect(transactions[0].type).equal("execute");

0 commit comments

Comments
 (0)