How to use the @cityofzion/neon-core.wallet.Account function in @cityofzion/neon-core

To help you get started, we’ve selected a few @cityofzion/neon-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CityOfZion / neon-js / packages / neon-nep5 / __tests__ / abi.ts View on Github external
test("transfer", () => {
  const account = new wallet.Account(
    "9ab7e154840daca3a2efadaf0df93cd3a5b51768c632f5433f86909d9b994a69"
  );
  const amtToSendTest = 922.33720369;
  const generator = abi.transfer(
    "9488220e8654d798f9b9cb9e74bd611ecc83fd0f",
    account.address,
    account.address,
    amtToSendTest
  );
  const builder = generator();

  const script =
    "0531e28e79151435b20010db73bf86371075ddfba4e6596f1ff35d1435b20010db73bf86371075ddfba4e6596f1ff35d53c1087472616e73666572670ffd83cc1e61bd749ecbb9f998d754860e228894";
  expect(builder["str"]).toBe(script);
});
github CityOfZion / neon-js / packages / neon-api / __tests__ / func / common.ts View on Github external
test("performs operation on empty tx", async () => {
    const config: DoInvokeConfig = {
      api: mockProvider,
      account: new wallet.Account("ALq7AWrhAueN6mJNqk6FHJjnsEoPRytLdW"),
      tx: new tx.InvocationTransaction(),
      script: ""
    };

    const result = await common.modifyTransactionForEmptyTransaction(config);
    expect(result.tx.attributes.length).toBe(2);
  });
github CityOfZion / neon-js / packages / neon-api / __tests__ / transaction / signer.ts View on Github external
const signWithInvlidAccount = (): void => {
      signer.signWithAccount(new wallet.Account());
    };
    expect(signWithInvlidAccount).toThrowError();
github CityOfZion / neon-js / packages / neon-api / __tests__ / transaction / signer.ts View on Github external
const ACCOUNTS = PRIVATE_KEYS.map(key => new wallet.Account(key));
github CityOfZion / neon-js / packages / neon-api / src / transaction / signer.ts View on Github external
private _checkAcc(account: wallet.Account | string): void {
    const acc = new wallet.Account(account);
    this._assertShouldSign(acc.scriptHash);
  }
github CityOfZion / neon-js / packages / neon-api / src / funcs / main.ts View on Github external
export function makeIntent(
  assetAmts: { [k: string]: number },
  address: string
): tx.TransactionOutput[] {
  const acct = new wallet.Account(address);
  return Object.keys(assetAmts).map(key => {
    return new tx.TransactionOutput({
      assetId: CONST.ASSET_ID[key],
      value: assetAmts[key],
      scriptHash: acct.scriptHash
    });
  });
}
github CityOfZion / neon-js / packages / neon-api / src / funcs / sign.ts View on Github external
export function signWithPrivateKey(
  privateKey: string
): (tx: string, publicKey: string) => Promise {
  const pubKey = new wallet.Account(privateKey).publicKey;
  return async (txString: string, publicKey?: string) => {
    const sig = wallet.sign(txString, privateKey);
    const witness = tx.Witness.fromSignature(sig, publicKey || pubKey);
    return witness.serialize();
  };
}