Skip to content

Commit 0237451

Browse files
committed
chore(deps): update borsh and base58 libraries
1 parent 1ed7aa1 commit 0237451

11 files changed

+372
-209
lines changed

examples/simple-project/yarn.lock

+347-133
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/js/dist/contract-state.d.ts

+2-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/js/dist/contract-state.d.ts.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/js/dist/contract-state.js

+2-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/js/dist/contract-state.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/js/dist/utils.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/js/dist/utils.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/js/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"main": "dist/index.js",
1616
"types": "dist/index.d.ts",
1717
"dependencies": {
18+
"@scure/base": "^1.2.0",
1819
"base64url": "^3.0.1",
1920
"bn.js": "^5.2.0",
20-
"borsh": "^0.5.0",
21-
"bs58": "^4.0.1",
21+
"borsh": "^2.0.0",
2222
"callsites": "^4.0.0",
2323
"fs-extra": "^10.0.0",
2424
"js-sha256": "^0.9.0",
@@ -55,7 +55,6 @@
5555
"npm": ">= 6.0.0"
5656
},
5757
"devDependencies": {
58-
"@types/bs58": "^4.0.1",
5958
"@types/proper-lockfile": "^4.1.2"
6059
},
6160
"gitHead": "20b58f0acd60d76517479f3b295f4c7ab938061f"

packages/js/src/contract-state.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Buffer} from 'buffer';
2-
import * as borsh from 'borsh';
2+
import {Schema, deserialize} from 'borsh';
33

44
export class ContractState {
55
private readonly data: Map<string, Buffer>;
@@ -14,10 +14,10 @@ export class ContractState {
1414
return this.data.get(key) ?? Buffer.from('');
1515
}
1616

17-
get(key: string, borshSchema?: {type: any; schema: any}): any {
17+
get(key: string, borshSchema: Schema): any {
1818
const value = this.getRaw(key);
1919
if (borshSchema) {
20-
return borsh.deserialize(borshSchema.schema, borshSchema.type, value);
20+
return deserialize(borshSchema, Uint8Array.from(value));
2121
}
2222

2323
return value.toJSON();

packages/js/src/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as os from 'os';
44
import * as path from 'path';
55
import * as nearAPI from 'near-api-js';
66
import sha256 from 'js-sha256';
7-
import bs58 from 'bs58';
7+
import {base58} from '@scure/base';
88
import {Gas, NEAR} from 'near-units';
99
import {NamedAccount, KeyPair, ClientConfig, KeyStore, BN} from './types';
1010

@@ -105,7 +105,7 @@ export function urlConfigFromNetwork(network: string | {network: string; rpcAddr
105105
export function hashContract(contract: string | Buffer): string {
106106
const bytes = typeof contract === 'string' ? Buffer.from(contract, 'base64') : contract;
107107
const buffer = Buffer.from(sha256.sha256(bytes), 'hex');
108-
return bs58.encode(buffer);
108+
return base58.encode(Uint8Array.from(buffer));
109109
}
110110

111111
export const EMPTY_CONTRACT_HASH = '11111111111111111111111111111111';

yarn.lock

+9-34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)