Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 80 additions & 131 deletions packages/lib/computer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ declare class Wallet {
readonly restClient: RestClient;
constructor(params?: ComputerOptions);
derive(subpath?: string): Wallet;
getBalance(): Promise<number>;
getUtxos(): Promise<_Unspent[]>;
getBalance(address?: string): Promise<number>;
getUtxos(address?: string): Promise<_Unspent[]>;
getDustThreshold(isWitnessProgram: boolean, script?: Buffer): number;
getAmountThreshold(isWitnessProgram: boolean, script: Buffer): number;
getUtxosWithOpts({ include, exclude }?: FundOptions): Promise<_Unspent[]>;
fetchUtxo: (utxo: _Unspent) => Promise<Utxo>;
fetchUtxo: ({ txId, vout }: _Unspent) => Promise<Utxo>;
checkFee(fee: number, size: number): void;
getSigOpCount(script: Buffer): number;
getLegacySigOpCount(tx: Transaction): Promise<number>;
getTransactionSigOpCost(tx: Transaction): Promise<number>;
getTxSize(txSize: any, nSigOpCost: any, bytesPerSigOp: any): number;
getTxSize(txSize: number, nSigOpCost: number, bytesPerSigOp: number): number;
estimatePsbtSize(tx: Psbt): number;
fundPsbt(tx: Psbt, opts?: FundOptions): Promise<void>;
getOutputSpent: (input: TxInput) => Promise<TxOutput>;
Expand All @@ -65,19 +65,16 @@ declare class Wallet {
estimateSize(tx: any): Promise<number>;
estimateFee(tx: any): Promise<number>;
fund(tx: Transaction, opts?: FundOptions): Promise<void>;
sign(
transaction: Transaction,
{ inputIndex, sighashType, inputScript }?: SigOptions
): Promise<void>;
sign(transaction: Transaction, { inputIndex, sighashType, inputScript }?: SigOptions): Promise<void>;
broadcast(tx: Transaction): Promise<string>;
send(satoshis: number, address: string): Promise<string>;
get hdPrivateKey(): any;
get hdPrivateKey(): BIP32Interface;
get privateKey(): Buffer;
get publicKey(): Buffer;
get passphrase(): string;
get path(): string;
get chain(): Chain;
get network(): Network;
get chain(): TBCChain;
get network(): TBCNetwork;
get url(): string;
get mnemonic(): string;
get address(): string;
Expand All @@ -98,88 +95,54 @@ declare class UrlFetch {
}

declare class RestClient {
readonly chain: Chain;
readonly network: Network;
readonly chain: TBCChain;
readonly network: TBCNetwork;
readonly networkObj: any;
readonly mnemonic: string;
readonly path: string;
readonly passphrase: string;
readonly addressType: AddressType;
readonly keyPair: BIP32Interface;
readonly bcn: UrlFetch;
readonly dustRelayTxFee: number;
readonly _keyPair: any;
satPerByte: number;
private randomAddress;
constructor({
chain,
network,
mnemonic,
path,
passphrase,
addressType,
url,
satPerByte,
dustRelayFee,
}?: ComputerOptions);
get privateKey(): Buffer;
get keyPair(): any;
constructor({ chain, network, mnemonic, path, passphrase, addressType, url, satPerByte, dustRelayFee }?: ComputerOptions);
rpc(method: string, params: string): Promise<any>;
broadcast(txHex: string): Promise<string>;
getBalance(address: string): Promise<number>;
getTransactions(txIds: string[]): Promise<_Transaction[]>;
getRawTxs(txIds: string[]): Promise<string[]>;
listTxs(address: string): Promise<_Transaction>;
getUtxos(address: string): Promise<_Unspent[]>;
query({
publicKey,
hash,
limit,
offset,
order,
ids,
mod,
}: Partial<Query>): Promise<string[]>;
getFormattedUtxos(address: string): Promise<_Unspent[]>;
getRawTxs(txIds: string[]): Promise<string[]>;
getTx(txId: string): Promise<_Transaction>;
query({ publicKey, hash, limit, offset, order, ids, mod }: Partial<Query>): Promise<string[]>;
idsToRevs(outIds: string[]): Promise<string[]>;
revToId(rev: string): Promise<string>;
rpc(method: string, params: string): Promise<any>;
static getSecretOutput({
_url,
keyPair,
}: {
_url: string;
keyPair: any;
static getSecretOutput({ _url, keyPair }: {
_url: string;
keyPair: BIP32Interface;
}): Promise<{
host: string;
data: string;
host: string;
data: string;
}>;
static setSecretOutput({
secretOutput,
host,
keyPair,
}: {
secretOutput: SecretOutput;
host: string;
keyPair: any;
static setSecretOutput({ secretOutput, host, keyPair }: {
secretOutput: SecretOutput;
host: string;
keyPair: BIP32Interface;
}): Promise<Data & (Encrypted | Stored)>;
static deleteSecretOutput({
_url,
keyPair,
}: {
_url: string;
keyPair: any;
static deleteSecretOutput({ _url, keyPair }: {
_url: string;
keyPair: BIP32Interface;
}): Promise<void>;
get url(): string;
broadcast(txHex: string): Promise<string>;
getTx(txId: string): Promise<_Transaction>;
getTxs(txIds: string[]): Promise<_Transaction[]>;
unspents(address: string): Promise<_Unspent[]>;
faucet(address: string, value: number): Promise<_Unspent>;
faucetScript(output: Buffer, value: number): Promise<_Unspent>;
verify(txo: _Unspent): Promise<void>;
mine(count: number): Promise<void>;
verify(txo: _Unspent): Promise<void>;
height(): Promise<number>;
listTxs(address: string): Promise<_Transaction>;
}

type Chain = "LTC" | "BTC";
type Network = "testnet" | "mainnet" | "regtest";
type TBCChain = "LTC" | "BTC";
type TBCNetwork = "testnet" | "mainnet" | "regtest";
type Fee = Partial<{
fee: number;
}>;
Expand Down Expand Up @@ -339,88 +302,74 @@ declare class Contract {
declare class Computer {
wallet: Wallet;
constructor(params?: ComputerOptions);
new<T extends Class>(
constructor: T,
args?: ConstructorParameters<T>,
mod?: string
): Promise<InstanceType<T> & Location>;
static lockdown(opts?: any): void;
delete(inRevs: string[]): Promise<string>;
decode(transaction: Transaction): Promise<TransitionJSON>;
encode(
json: Partial<TransitionJSON & FundOptions & SigOptions & MockOptions>
): Promise<{
tx?: Transaction;
effect: Effect;
new<T extends Class>(constructor: T, args?: ConstructorParameters<T>, mod?: string): Promise<InstanceType<T> & Location>;
query<T extends Class>(q: UserQuery<T>): Promise<string[]>;
sync(rev: string): Promise<unknown>;
encode(json: Partial<TransitionJSON & FundOptions & SigOptions & MockOptions>): Promise<{
tx: Transaction;
effect: Effect;
}>;
encodeNew<T extends Class>({
constructor,
args,
mod,
}: {
constructor: T;
args: ConstructorParameters<T>;
mod?: string;
root?: string;
encodeNew<T extends Class>({ constructor, args, mod }: {
constructor: T;
args: ConstructorParameters<T>;
mod?: string;
root?: string;
}): Promise<{
tx?: Transaction;
effect: Effect;
tx: Transaction;
effect: Effect;
}>;
getUtxos(address?: string): Promise<string[]>;
encodeCall<T extends Class, K extends keyof InstanceType<T>>({
target,
property,
args,
mod,
}: {
target: InstanceType<T> & Location;
property: string;
args: Parameters<InstanceType<T>[K]>;
mod?: string;
encodeCall<T extends Class, K extends keyof InstanceType<T>>({ target, property, args, mod }: {
target: InstanceType<T> & Location;
property: string;
args: Parameters<InstanceType<T>[K]>;
mod?: string;
}): Promise<{
tx?: Transaction;
effect: Effect;
tx: Transaction;
effect: Effect;
}>;
query<T extends Class>(q: UserQuery<T>): Promise<string[]>;
decode(transaction: Transaction): Promise<TransitionJSON>;
deploy(module: string, opts?: Partial<InscriptionOptions>): Promise<string>;
load(rev: string): Promise<any>;
getChain(): Chain;
getNetwork(): Network;
load(rev: string): Promise<ModuleExportsNamespace>;
listTxs(address?: string): Promise<import("./types")._Transaction>;
getUtxos(address?: string): Promise<string[]>;
getBalance(address?: string): Promise<number>;
sign(transaction: Transaction, opts?: SigOptions): Promise<void>;
fund(tx: Transaction, opts?: Fee & FundOptions): Promise<void>;
send(satoshis: number, address: string): Promise<string>;
broadcast(tx: Transaction): Promise<string>;
rpcCall(method: string, params: string): Promise<any>;
txFromHex({ hex }: {
hex: string;
}): Promise<TBCTransaction>;
getChain(): TBCChain;
getNetwork(): TBCNetwork;
getMnemonic(): string;
getPrivateKey(): string;
getPassphrase(): string;
getPath(): string;
getUrl(): string;
getPublicKey(): string;
getAddress(): string;
setFee(fee: number): void;
getAddressType(): string;
getFee(): number;
getBalance(): Promise<number>;
sign(transaction: Transaction, opts?: SigOptions): Promise<void>;
fund(tx: Transaction, opts?: Fee & FundOptions): Promise<void>;
broadcast(tx: Transaction): Promise<string>;
sync(rev: string): Promise<unknown>;
send(satoshis: number, address: string): Promise<string>;
rpcCall(method: string, params: string): Promise<any>;
txFromHex({ hex }: { hex?: string | undefined }): Promise<any>;
getInscription(
rawTx: string,
index: number
): {
contentType: string;
body: string;
setFee(fee: number): void;
faucet(amount: number, address?: string): Promise<_Unspent>;
static getInscription(rawTx: string, index: number): {
contentType: string;
body: string;
};
listTxs(address?: string): Promise<_Transaction>;
toScriptPubKey(publicKeys?: string[]): Buffer | undefined;
static lockdown(opts?: any): void;
delete(inRevs: string[]): Promise<string>;
export(module: string, opts?: Partial<InscriptionOptions>): Promise<string>;
import(rev: string): Promise<any>;
import(rev: string): Promise<ModuleExportsNamespace>;
queryRevs(q: Query): Promise<string[]>;
getOwnedRevs(publicKey?: Buffer): Promise<string[]>;
getRevs(publicKey?: Buffer): Promise<string[]>;
getLatestRevs(ids: string[]): Promise<string[]>;
getLatestRev(id: string): Promise<string>;
idsToRevs(ids: string[]): Promise<string[]>;
faucet(amount: number, address?: string): Promise<_Unspent>;
toScriptPubKey(publicKeys?: string[]): Buffer;
getMinimumFees(): number;
}

export { Computer, Contract, Mock };
4 changes: 2 additions & 2 deletions packages/lib/dist/bc-lib.browser.min.mjs

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions packages/lib/dist/bc-lib.commonjs.min.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/lib/dist/bc-lib.main.es.mjs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/lib/dist/bc-lib.module.es.mjs

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions packages/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@
"main": "dist/bc-lib.main.es.mjs",
"module": "dist/bc-lib.module.es.mjs",
"browser": "dist/bc-lib.browser.es.mjs",
"cjs": "dist/bc-lib.commonjs.min.cjs",
"exports": {
".": {
"node": {
"import": "./dist/bc-lib.main.es.mjs",
"require": "./dist/bc-lib.commonjs.min.cjs"
},
"browser": {
"import": "./dist/bc-lib.module.es.mjs"
},
"default": "./dist/bc-lib.main.es.mjs"
}
},
"homepage": "http://bitcoincomputer.io/",
"author": {
"name": "Clemens Ley",
Expand Down
1 change: 1 addition & 0 deletions packages/nft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"react-icons": "^5.0.1",
"react-router-dom": "^6.22.1",
"react-scripts": "5.0.1",
"react-string-replace": "^1.1.1",
"tailwindcss": "^3.4.1",
"typescript": "^4.9.5",
"web-vitals": "^3.5.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/node/dist/bcn.es.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/node/dist/bcn.sync.es.mjs

Large diffs are not rendered by default.