diff --git a/samples/multisign.js b/samples/multisign.js index 4e3c9fa..840d68f 100644 --- a/samples/multisign.js +++ b/samples/multisign.js @@ -5,7 +5,7 @@ console.log(); /** * You can try this at TestNet, - * https://developers.ripple.com/xrp-test-net-faucet.html + * https://xrpl.org/xrp-testnet-faucet.html * Using: * https://xrp.fans/ (Click the "Switch to TESTNET" button) */ diff --git a/samples/sign-and-submit.mjs b/samples/sign-and-submit.mjs index fb85098..831a31a 100644 --- a/samples/sign-and-submit.mjs +++ b/samples/sign-and-submit.mjs @@ -1,14 +1,14 @@ import { - derive, utils, signAndSubmit, + XRPL_Account, } from "../dist/index.js"; // require('xrpl-accountlib') after `npm install xrpl-accountlib` in prod. console.log("Sign & Submit (Custom Definitions)"); console.log(); const wss = 'wss://hooks-testnet-v3.xrpl-labs.com/' -const account = derive.familySeed("ssi4moYHYkWs2RPzRvrXzMrbpxqAJ") +const account = XRPL_Account.fromFamilySeed("ssi4moYHYkWs2RPzRvrXzMrbpxqAJ") const networkInfo = await utils.txNetworkAndAccountValues(wss, account) diff --git a/samples/sign-custom-defs.js b/samples/sign-custom-defs.js index 00f9315..3e196f5 100644 --- a/samples/sign-custom-defs.js +++ b/samples/sign-custom-defs.js @@ -8,7 +8,7 @@ console.log(); /** * You can try this at TestNet, - * https://developers.ripple.com/xrp-test-net-faucet.html + * https://xrpl.org/xrp-testnet-faucet.html * Using: * https://xrp.fans/ (Click the "Switch to TESTNET" button) */ diff --git a/samples/sign.js b/samples/sign.js index 8974422..50945db 100644 --- a/samples/sign.js +++ b/samples/sign.js @@ -5,7 +5,7 @@ console.log(); /** * You can try this at TestNet, - * https://developers.ripple.com/xrp-test-net-faucet.html + * https://xrpl.org/xrp-testnet-faucet.html * Using: * https://xrp.fans/ (Click the "Switch to TESTNET" button) */ @@ -22,7 +22,7 @@ const Tx = { console.log( "Sign: one account", - lib.sign(Tx, lib.derive.familySeed("shqNUmrgnkBmK9iCijrtid2Ua4uHd")) + lib.sign(Tx, lib.XRPL_Account.fromFamilySeed("shqNUmrgnkBmK9iCijrtid2Ua4uHd")) ); console.log(); @@ -30,7 +30,7 @@ console.log("Sign: multiSign"); console.dir( lib.sign(Tx, [ lib.derive.familySeed("sp5mkm12oJj3t8fFRiaMNrDbc73N2"), - lib.derive.familySeed("shqNUmrgnkBmK9iCijrtid2Ua4uHd") + lib.XRPL_Account.fromFamilySeed("shqNUmrgnkBmK9iCijrtid2Ua4uHd") ]), { depth: null } ); diff --git a/src/schema/Account.ts b/src/schema/Account.ts index 56f8310..d7f749f 100644 --- a/src/schema/Account.ts +++ b/src/schema/Account.ts @@ -2,6 +2,7 @@ import { deriveAddress } from "ripple-keypairs"; import * as AddressCodec from "ripple-address-codec"; import * as Elliptic from "elliptic"; import * as Utils from "../utils"; +import { derive } from ".."; const Ed25519 = new Elliptic.eddsa("ed25519"); const Secp256k1 = new Elliptic.ec("secp256k1"); @@ -173,6 +174,12 @@ export default class XRPL_Account { return this; } + static fromMnemonic: typeof derive.mnemonic = (...params) => derive.mnemonic(...params) + static fromFamilySeed: typeof derive.familySeed = (...params) => derive.familySeed(...params) + static fromSecretNumbers: typeof derive.secretNumbers = (...params) => derive.secretNumbers(...params) + static fromPrivatekey: typeof derive.privatekey = (...params) => derive.privatekey(...params) + static fromPassphrase: typeof derive.passphrase = (...params) => derive.passphrase(...params) + toString() { return "XPRL Account" + (this.address ? ": " + this.address : ""); }