Skip to content

Commit

Permalink
remove js-xdr dependency, use cereal namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
BlaineHeffron committed May 13, 2024
1 parent 8d1303e commit 9ae8398
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@
"webpack-cli": "^5.0.1"
},
"dependencies": {
"@stellar/js-xdr": "^3.1.1",
"@stellar/stellar-base": "11.1.0",
"axios": "^1.6.8",
"bignumber.js": "^9.1.2",
Expand Down
2 changes: 1 addition & 1 deletion src/contract_client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class ContractClient {
options: ContractClientOptions,
format: "hex" | "base64" = "hex"
): Promise<ContractClient> {
if (!options || !options.rpcUrl ) {
if (!options || !options.rpcUrl) {
throw new TypeError('options must contain rpcUrl');
}
const { rpcUrl, allowHttp } = options;
Expand Down
9 changes: 4 additions & 5 deletions src/contract_client/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// @ts-ignore
import { XdrReader } from "@stellar/js-xdr";
import { xdr } from "..";
import { xdr, cereal } from "..";

/**
* The default timeout for waiting for a transaction to be included in a block.
Expand Down Expand Up @@ -89,9 +87,10 @@ export function implementsToString(obj: unknown): obj is { toString(): string }
* Reads a binary stream of ScSpecEntries into an array for processing by ContractSpec
*/
export function processSpecEntryStream(buffer: Buffer) {
const reader = new XdrReader(buffer);
const reader = new cereal.XdrReader(buffer);
const res: xdr.ScSpecEntry[] = [];
while (reader._index < reader._length) {
while (!reader.eof){
// @ts-ignore
res.push(xdr.ScSpecEntry.read(reader));
}
return res;
Expand Down
1 change: 0 additions & 1 deletion src/soroban/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ export class Server {
* @returns {Promise<Buffer>} a Buffer containing the WASM bytecode
*
* @throws {Error} If the contract or its associated WASM bytecode cannot be
* :
* found on the network.
*
* @example
Expand Down

0 comments on commit 9ae8398

Please sign in to comment.