How to use the @cityofzion/neon-core.tx.Witness 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-api / __tests__ / transaction / signer.ts View on Github external
test("multiple witnesses", () => {
    const signer = createTransactionSigner();
    signer.signWithWitness(
      new tx.Witness(ACCOUNTS_WITNESSES[0]),
      new tx.Witness(ACCOUNTS_WITNESSES[1])
    );
    expect(signer.transaction.scripts[0].export()).toEqual(
      ACCOUNTS_WITNESSES[0]
    );
    expect(signer.transaction.scripts[1].export()).toEqual(
      ACCOUNTS_WITNESSES[1]
    );
  });
github CityOfZion / neon-js / packages / neon-api / __tests__ / transaction / signer.ts View on Github external
test("multiple witnesses", () => {
    const signer = createTransactionSigner();
    signer.signWithWitness(
      new tx.Witness(ACCOUNTS_WITNESSES[0]),
      new tx.Witness(ACCOUNTS_WITNESSES[1])
    );
    expect(signer.transaction.scripts[0].export()).toEqual(
      ACCOUNTS_WITNESSES[0]
    );
    expect(signer.transaction.scripts[1].export()).toEqual(
      ACCOUNTS_WITNESSES[1]
    );
  });
github CityOfZion / neon-js / packages / neon-api / __tests__ / transaction / signer.ts View on Github external
const signWithInvalidWitness = (): void => {
      signer.signWithWitness(
        new tx.Witness({
          invocationScript: "abcd",
          verificationScript:
            "21032879f12ac79b9305bf768bb50f1c1c889330361fee037fe886f820bcaa521553ac"
        })
      );
    };
    expect(signWithInvalidWitness).toThrowError();
github CityOfZion / neon-js / packages / neon-api / src / funcs / common.ts View on Github external
export async function getVerificationSignatureForSmartContract(
  url: string,
  smartContractScriptHash: string
): Promise {
  const contractState = await rpc.Query.getContractState(
    smartContractScriptHash
  ).execute(url);
  const { parameters } = contractState.result;
  const witness = new tx.Witness({
    invocationScript: "00".repeat(parameters.length),
    verificationScript: ""
  });

  witness.scriptHash = smartContractScriptHash;
  return witness;
}