@bsv/wallet-toolbox
Version:
BRC100 conforming wallet, wallet storage and wallet signer components
56 lines • 2.39 kB
TypeScript
import { Beef, WalletProtocol } from '@bsv/sdk';
import { SetupWallet } from '../../src';
/**
* Example of moving satoshis from one wallet to another using the BRC29 script template.
*
* This example can be run by the following command:
*
* ```bash
* npx tsx brc29.ts
* ```
*
* Combine this with the [balances](./README.md#function-balances) example to observe satoshis being transfered between
* two wallets.
*
* @publicbody
*/
export declare function transferPushDrop(): Promise<void>;
/**
* Consume a PushDrop output.
*
* To spend a PushDrop output a transaction input must be created and signed using the
* associated private key.
*
* In this example, an initial `createAction` call constructs the overall shape of a
* new transaction, returning a `signableTransaction`.
*
* The `tx` property of the `signableTransaction` should be parsed using
* the standard `Beef` class. Note that it is not an ordinary AtomicBEEF for the
* simple reason that the transaction has not yet been fully signed.
*
* You can either use the method shown here to obtain a signable `Transaction` object
* from this beef or you can use the `Transaction.fromAtomicBEEF` method.
*
* To sign an input, set the corresponding input's `unlockingScriptTemplate` to an appropriately
* initialized unlock object and call the `Transaction` `sign` method.
*
* Once signed, capture the input's now valid `unlockingScript` value and convert it to a hex string.
*
* @param {SetupWallet} setup The setup context which will consume a PushDrop output as an input to a new transaction transfering
* the output's satoshis to the "change" managed by the context's wallet.
* @param {Beef} outputPushDrop.beef - An object proving the validity of the new output where the last transaction contains the new output.
* @param {string} outputPushDrop.outpoint - The txid and index of the outpoint in the format `${txid}.${index}`.
* @param {string} outputPushDrop.fromIdentityKey - The public key that locked the output.
* @param {number} outputPushDrop.satoshis - The amount assigned to the output.
*
* @publicbody
*/
export declare function inputPushDrop(setup: SetupWallet, outputPushDrop: {
beef: Beef;
outpoint: string;
fromIdentityKey: string;
satoshis: number;
protocol: WalletProtocol;
keyId: string;
}): Promise<void>;
//# sourceMappingURL=pushdrop.test.d.ts.map