Skip to content

Latest commit

 

History

History
 
 

algo_models_ffi

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

algo_models_ffi

Provides interfaces for UniFFI and wasm-pack for the algo_models crate.

Key Files

Example

TypeScript

Example of using the library in TypeScript:

const fields = {
  header: {
    sender: tx.snd,
    fee: tx.fee,
    transactionType: "Payment",
    firstValid: tx.fv,
    lastValid: tx.lv,
    genesisHash: tx.gh,
    genesisId: tx.gen,
  },
  receiver: tx.rcv,
  amount: tx.amt,
} as PayTransactionFields;

const btyesForSigning = encodePayment(fields);

// Signing with a ed25519 lib that has no idea about Algorand
const sig = await ed.signAsync(btyesForSigning, privKey);
const signedTx = attachSignature(btyesForSigning, sig);

See tests/js/index.ts for the full example.