From 92e9c5f5608c083989a70f751783cca5596770a2 Mon Sep 17 00:00:00 2001 From: gotjoshua Date: Thu, 30 Sep 2021 10:06:24 +0100 Subject: [PATCH] #172 use bs58 lib --- packages/serum/package.json | 2 +- packages/serum/src/instructions.test.js | 8 ++------ yarn.lock | 5 ----- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/serum/package.json b/packages/serum/package.json index 20db1caf..9e53825d 100644 --- a/packages/serum/package.json +++ b/packages/serum/package.json @@ -49,8 +49,8 @@ "@project-serum/anchor": "^0.11.1", "@solana/spl-token": "^0.1.6", "@solana/web3.js": "^1.21.0", - "basex-encoder": "^0.0.10", "bn.js": "^5.1.2", + "bs58": "^4.0.1", "buffer-layout": "^1.2.0" }, "browserslist": [ diff --git a/packages/serum/src/instructions.test.js b/packages/serum/src/instructions.test.js index dec2748b..df893d7a 100644 --- a/packages/serum/src/instructions.test.js +++ b/packages/serum/src/instructions.test.js @@ -1,10 +1,6 @@ import { encodeInstruction, decodeInstruction } from './instructions'; import BN from 'bn.js'; -import { encoder } from "basex-encoder"; - -const base58 = encoder( - "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" -); +import base58 from 'bs58'; describe('instruction', () => { it('encodes initialize market', () => { @@ -39,7 +35,7 @@ describe('instruction', () => { it('decodes new order from rawbytes', () => { const newOrderExpectedJSON = '{"newOrderV3":{"side":"buy","limitPrice":"011d28","maxBaseQuantity":"0122","maxQuoteQuantity":"7e2edb40","selfTradeBehavior":"decrementTake","orderType":"limit","clientId":"00","limit":65535}}' const newOrderInstData58 = '189VEfQCdeLeDg3Y6qq3iVwwij5GobKfSvh42MPYfkCpGVM4TkjdwRK9FdLswwBvABt5k' - const newOrderInstDataBytes = base58.decodeToBuffer(newOrderInstData58) + const newOrderInstDataBytes = base58.decode(newOrderInstData58) const orderObj = decodeInstruction(newOrderInstDataBytes); expect(JSON.stringify(orderObj)).toEqual(newOrderExpectedJSON); }); diff --git a/yarn.lock b/yarn.lock index 7c8d6e60..7b775b59 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2515,11 +2515,6 @@ base@^0.11.1: mixin-deep "^1.2.0" pascalcase "^0.1.1" -basex-encoder@^0.0.10: - version "0.0.10" - resolved "https://registry.yarnpkg.com/basex-encoder/-/basex-encoder-0.0.10.tgz#3c89e54a49650133a6920cf4a57506032cd86ab4" - integrity sha512-7C/hMsE+cWNTxy+N1heJ5e540eIHIUpF5jTRz9sdSRvCYDDvaSNZ1/tDUqm9fwDxhAZu6jkOexxlEvyoTzaRMg== - bcrypt-pbkdf@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e"