Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/erdjs-publish-alpha-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
echo "" >> notes.txt

RELEASE_TAG=v$(node -p "require('./package.json').version")
gh release create --prerelease $RELEASE_TAG --title="$RELEASE_TAG" --generate-notes --notes-file=notes.txt
gh release create --prerelease $RELEASE_TAG --target=$GITHUB_SHA --title="$RELEASE_TAG" --generate-notes --notes-file=notes.txt

- run: npm ci
- run: npm test
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/erdjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ jobs:
- run: npm ci
- run: npm run compile
- run: npm run compile-browser
- run: npm run compile-browser-min
- run: npm test
24,318 changes: 16,244 additions & 8,074 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 2 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
"tests-mainnet": "mocha $(find . -name '*.main.net.spec.ts')",
"compile-browser": "tsc -p tsconfig.json && browserify out/index.js -o out-browser/erdjs.js --standalone erdjs -p esmify",
"compile-browser-min": "tsc -p tsconfig.json && browserify out/index.js -o out-browser/erdjs.min.js --standalone erdjs -p esmify -p tinyify",
"compile-browser-nowallet": "tsc -p tsconfig.json && browserify out/index.js -o out-browser/erdjs.nowallet.js --standalone erdjs --exclude=**/walletcore/** -p esmify",
"compile-browser-nowallet-min": "tsc -p tsconfig.json && browserify out/index.js -o out-browser/erdjs.nowallet.min.js --standalone erdjs --exclude=**/walletcore/** -p tinyify -p esmify",
"compile": "tsc -p tsconfig.json && npm run copy-files",
"compile-proto": "npx pbjs -t static-module -w commonjs -o src/proto/compiled.js src/proto/transaction.proto && npx pbts -o src/proto/compiled.d.ts src/proto/compiled.js",
"copy-files": "mkdir -p out/testutils/ && mkdir -p out/abi/ && cp -R src/abi/* out/abi/",
Expand All @@ -41,23 +39,18 @@
"axios": "0.24.0",
"bech32": "1.1.4",
"bignumber.js": "9.0.1",
"bip39": "3.0.2",
"blake2b": "2.1.3",
"buffer": "6.0.3",
"ed25519-hd-key": "1.1.2",
"json-bigint": "1.0.0",
"json-duplicate-key-handle": "1.0.0",
"keccak": "^3.0.1",
"platform": "1.3.6",
"protobufjs": "6.10.2",
"qs": "6.10.1",
"scryptsy": "2.1.0",
"tweetnacl": "1.0.3",
"uuid": "8.3.2"
"qs": "6.10.1"
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"@elrondnetwork/erdjs-walletcore": "1.0.0",
"@types/assert": "1.4.6",
"@types/chai": "4.2.11",
"@types/ledgerhq__hw-transport-u2f": "4.21.2",
Expand Down
1 change: 0 additions & 1 deletion src/_docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ export * from "./networkConfig";
export * from "./networkStake";
export * from "./networkParams";
export * from "./utils";
export * from "./nullSigner";
25 changes: 25 additions & 0 deletions src/boundaryAdapters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Address } from "./address";
import { ErrInvariantFailed } from "./errors";
import { Signature } from "./signature";

/**
* Adapts a signature created by other components (e.g. erdjs-walletcore, erdjs-hw-provider) to one understood by erdjs.
*/
export function adaptToSignature(obj: any): Signature {
if (!obj.hex || typeof obj.hex() !== "string") {
throw new ErrInvariantFailed("adaptToSignature: bad or missing hex()")
}

return new Signature(obj.hex());
}

/**
* Adapts an address created by other components (e.g. erdjs-walletcore, erdjs-hw-provider) to one understood by erdjs.
*/
export function adaptToAddress(obj: any): Address {
if (!obj.bech32 || typeof obj.bech32() !== "string") {
throw new ErrInvariantFailed("adaptToSignature: bad or missing bech32()")
}

return new Address(obj.bech32());
}
5 changes: 0 additions & 5 deletions src/crypto/constants.ts

This file was deleted.

27 changes: 0 additions & 27 deletions src/crypto/decryptor.ts

This file was deleted.

36 changes: 0 additions & 36 deletions src/crypto/derivationParams.ts

This file was deleted.

22 changes: 0 additions & 22 deletions src/crypto/encrypt.spec.ts

This file was deleted.

65 changes: 0 additions & 65 deletions src/crypto/encryptedData.ts

This file was deleted.

30 changes: 0 additions & 30 deletions src/crypto/encryptor.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/crypto/index.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/crypto/randomness.ts

This file was deleted.

11 changes: 1 addition & 10 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class ErrBadType extends Err {
*/
export class ErrInvariantFailed extends Err {
public constructor(message: string) {
super(`"Invariant failed: ${message}`);
super(`Invariant failed: [${message}]`);
}
}

Expand Down Expand Up @@ -136,15 +136,6 @@ export class ErrAddressEmpty extends Err {
}
}

/**
* Signals an error related to signing a message (a transaction).
*/
export class ErrSignerCannotSign extends Err {
public constructor(inner: Error) {
super(`Cannot sign`, inner);
}
}

/**
* Signals an invalid value for {@link Balance} objects.
*/
Expand Down
5 changes: 0 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ export * from "./scArgumentsParser";
export * from "./esdtHelpers";
export * from "./token";

// TODO: Do not export "crypto" and "walletcore", by default (not needed by most dapps).
export * from "./crypto";
export * from "./walletcore";
export * from "./nullSigner";

export * from "./smartcontracts";

export * from "./networkProvider";
Expand Down
23 changes: 2 additions & 21 deletions src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,6 @@ export interface IApiProvider extends ITransactionFetcher {
doGetGeneric(resourceUrl: string, callback: (response: any) => any): Promise<any>;
}

/**
* An interface that defines a signing-capable object.
*/
export interface ISigner {
/**
* Gets the {@link Address} of the signer.
*/
getAddress(): Address;

/**
* Signs a message (e.g. a {@link Transaction}).
*/
sign(signable: ISignable): Promise<void>;
}

export interface IVerifier {
verify(message: IVerifiable): boolean;
}

/**
* An interface that defines a signable object (e.g. a {@link Transaction}).
*/
Expand All @@ -140,9 +121,9 @@ export interface ISignable {
* Applies the computed signature on the object itself.
*
* @param signature The computed signature
* @param signedBy The address of the {@link Signer}
* @param signedBy The address of the signer
*/
applySignature(signature: Signature, signedBy: Address): void;
applySignature(signature: any, signedBy: any): void;
}

/**
Expand Down
Loading