Skip to content

Commit 7d18591

Browse files
committed
chore: update gno js libraries
1 parent 4957f1c commit 7d18591

File tree

8 files changed

+494
-740
lines changed

8 files changed

+494
-740
lines changed

packages/adena-extension/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@
7575
"webpack-merge": "5.10.0"
7676
},
7777
"dependencies": {
78-
"@adena-wallet/sdk": "0.0.12",
78+
"@adena-wallet/sdk": "0.0.13",
7979
"@bufbuild/protobuf": "2.2.3",
80-
"@gnolang/gno-js-client": "1.4.4",
80+
"@gnolang/gno-js-client": "1.4.5",
8181
"@gnolang/tm2-js-client": "1.3.3",
8282
"@tanstack/react-query": "4.36.1",
8383
"adena-module": "*",

packages/adena-extension/src/common/provider/gno/gno-provider.ts

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
} from '@gnolang/tm2-js-client';
2424
import { ResponseDeliverTx } from '@gnolang/tm2-js-client/bin/proto/tm2/abci';
2525
import axios from 'axios';
26-
import { ABCIAccount, AccountInfo, GnoDocumentInfo, VMQueryType } from './types';
26+
import { AccountInfo, GnoDocumentInfo, VMQueryType } from './types';
2727
import {
2828
fetchABCIResponse,
2929
isHttpsAvailable,
@@ -91,55 +91,38 @@ export class GnoProvider extends GnoJSONRPCProvider {
9191
address: string,
9292
height?: number | undefined,
9393
): Promise<AccountInfo | null> {
94-
const defaultAccount: AccountInfo = {
95-
address: '',
96-
coins: '',
97-
chainId: '',
98-
status: 'IN_ACTIVE',
99-
publicKey: null,
100-
accountNumber: '0',
101-
sequence: '0',
102-
};
103-
const requestBody = newRequest(ABCIEndpoint.ABCI_QUERY, [
104-
`auth/accounts/${address}`,
105-
'',
106-
`${height ?? 0}`,
107-
false,
108-
]);
109-
110-
const abciResponse = await postABCIResponse(this.baseURL, requestBody).catch(() => null);
111-
112-
const abciData = abciResponse?.result?.response.ResponseBase.Data;
113-
// Make sure the response is initialized
114-
if (!abciData) {
115-
return defaultAccount;
116-
}
94+
const abciAccount = await this.getAccount(address, height).catch((e) => {
95+
console.info(e);
96+
return null;
97+
});
11798

118-
try {
119-
// Parse the account
120-
const account: ABCIAccount = parseABCI<ABCIAccount>(abciData);
121-
const {
122-
address,
123-
coins,
124-
sequence,
125-
account_number: accountNumber,
126-
public_key: publicKey,
127-
} = account.BaseAccount;
99+
if (!abciAccount || !abciAccount.BaseAccount) {
128100
return {
129-
address,
130-
coins,
131-
chainId: this.chainId ?? '',
132-
status: 'ACTIVE',
133-
publicKey: publicKey,
134-
accountNumber,
135-
sequence,
101+
address: '',
102+
coins: '',
103+
chainId: '',
104+
status: 'IN_ACTIVE',
105+
publicKey: null,
106+
accountNumber: '0',
107+
sequence: '0',
136108
};
137-
} catch (e) {
138-
console.info(e);
139109
}
110+
111+
const {
112+
coins,
113+
public_key: publicKey,
114+
account_number: accountNumber,
115+
sequence,
116+
} = abciAccount.BaseAccount;
117+
140118
return {
141-
...defaultAccount,
142119
address,
120+
coins,
121+
chainId: this.chainId ?? '',
122+
status: 'ACTIVE',
123+
publicKey,
124+
accountNumber,
125+
sequence,
143126
};
144127
}
145128

packages/adena-module/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"dependencies": {
4141
"@cosmjs/ledger-amino": "0.36.0",
42-
"@gnolang/gno-js-client": "1.4.4",
42+
"@gnolang/gno-js-client": "1.4.5",
4343
"@gnolang/tm2-js-client": "1.3.3",
4444
"@ledgerhq/hw-transport": "6.31.4",
4545
"@ledgerhq/hw-transport-mocker": "6.29.4",

packages/adena-module/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export * from './crypto';
22
export * from './encoding';
33
export * from './ledger';
4-
export * from './libs';
54
export * from './math';
65
export * from './utils';
76
export * from './wallet';

packages/adena-module/src/libs/gno-js-client/proto/gno/event.ts

Lines changed: 0 additions & 219 deletions
This file was deleted.

packages/adena-module/src/libs/gno-js-client/proto/gno/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/adena-module/src/libs/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)