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
2 changes: 1 addition & 1 deletion rgb-lib
Submodule rgb-lib updated 41 files
+4 −4 .github/workflows/build.yml
+7 −7 .github/workflows/test.yml
+401 −836 Cargo.lock
+14 −18 Cargo.toml
+4 −2 bindings/README.md
+888 −1,307 bindings/c-ffi/Cargo.lock
+6 −0 bindings/c-ffi/Cargo.toml
+91 −0 bindings/c-ffi/src/lib.rs
+109 −0 bindings/c-ffi/src/utils.rs
+849 −1,268 bindings/uniffi/Cargo.lock
+6 −0 bindings/uniffi/Cargo.toml
+111 −16 bindings/uniffi/src/lib.rs
+10 −9 bindings/uniffi/src/rgb-lib.udl
+0 −60 src/database/entities/pending_witness_outpoint.rs
+5 −5 src/database/enums.rs
+1 −8 src/error.rs
+13 −21 src/lib.rs
+50 −92 src/utils.rs
+44 −37 src/wallet/offline.rs
+19 −80 src/wallet/online.rs
+37 −44 src/wallet/rust_only.rs
+3 −3 src/wallet/test/blind_receive.rs
+33 −27 src/wallet/test/create_utxos.rs
+11 −0 src/wallet/test/drain_to.rs
+6 −6 src/wallet/test/get_asset_balance.rs
+25 −6 src/wallet/test/go_online.rs
+265 −29 src/wallet/test/inflate.rs
+19 −6 src/wallet/test/issue_asset_cfa.rs
+28 −7 src/wallet/test/issue_asset_ifa.rs
+19 −6 src/wallet/test/issue_asset_nia.rs
+19 −6 src/wallet/test/issue_asset_uda.rs
+2 −0 src/wallet/test/mod.rs
+95 −1 src/wallet/test/refresh.rs
+8 −7 src/wallet/test/rust_only.rs
+585 −53 src/wallet/test/send.rs
+11 −1 src/wallet/test/send_btc.rs
+100 −14 src/wallet/test/utils/api.rs
+4 −5 src/wallet/test/utils/chain.rs
+115 −79 src/wallet/test/utils/helpers.rs
+21 −2 tests/compose.yaml
+44 −6 tests/regtest.sh
1 change: 1 addition & 0 deletions template/swig.i
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

%apply optional_string {
const char* asset_id_opt,
const char* batch_transfer_idx_opt,
const char* details_opt,
const char* duration_seconds_opt,
const char* file_path_opt,
Expand Down
136 changes: 136 additions & 0 deletions template/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,90 @@ exports.Wallet = class Wallet {
);
}

createUtxosBegin(online, upTo, num, size, feeRate, skipSync) {
const params = { online, upTo, num, size, feeRate, skipSync };
const expectedTypes = {
online: "object",
upTo: "boolean",
num: "u8?",
size: "u32?",
feeRate: "u64",
skipSync: "boolean",
};
validateTypes(params, expectedTypes);
return lib.rgblib_create_utxos_begin(
this.wallet,
online,
upTo,
num,
size,
feeRate,
skipSync,
);
}

createUtxosEnd(online, signedPsbt, skipSync) {
const params = { online, signedPsbt, skipSync };
const expectedTypes = {
online: "object",
signedPsbt: "string",
skipSync: "boolean",
};
validateTypes(params, expectedTypes);
return JSON.parse(
lib.rgblib_create_utxos_end(
this.wallet,
online,
signedPsbt,
skipSync,
),
);
}

deleteTransfers(batchTransferIdx, noAssetOnly) {
const params = {
batchTransferIdx,
noAssetOnly,
};
const expectedTypes = {
batchTransferIdx: "i32?",
noAssetOnly: "boolean",
};
validateTypes(params, expectedTypes);
return JSON.parse(
lib.rgblib_delete_transfers(
this.wallet,
batchTransferIdx,
noAssetOnly,
),
);
}

failTransfers(online, batchTransferIdx, noAssetOnly, skipSync) {
const params = {
online,
batchTransferIdx,
noAssetOnly,
skipSync,
};
const expectedTypes = {
online: "object",
batchTransferIdx: "i32?",
noAssetOnly: "boolean",
skipSync: "boolean",
};
validateTypes(params, expectedTypes);
return JSON.parse(
lib.rgblib_fail_transfers(
this.wallet,
online,
batchTransferIdx,
noAssetOnly,
skipSync,
),
);
}

getAddress() {
return lib.rgblib_get_address(this.wallet);
}
Expand All @@ -313,6 +397,15 @@ exports.Wallet = class Wallet {
return JSON.parse(lib.rgblib_get_asset_balance(this.wallet, assetId));
}

getAssetMetadata(assetId) {
const params = { assetId };
const expectedTypes = {
assetId: "string",
};
validateTypes(params, expectedTypes);
return JSON.parse(lib.rgblib_get_asset_metadata(this.wallet, assetId));
}

getBtcBalance(online, skipSync) {
const params = { online, skipSync };
const expectedTypes = {
Expand Down Expand Up @@ -556,6 +649,32 @@ exports.Wallet = class Wallet {
);
}

sendBegin(online, recipientMap, donation, feeRate, minConfirmations) {
const params = {
online,
recipientMap,
donation,
feeRate,
minConfirmations,
};
const expectedTypes = {
online: "object",
recipientMap: "object",
donation: "boolean",
feeRate: "u64",
minConfirmations: "u8",
};
validateTypes(params, expectedTypes);
return lib.rgblib_send_begin(
this.wallet,
online,
JSON.stringify(recipientMap),
donation,
feeRate,
minConfirmations,
);
}

sendBtc(online, address, amount, feeRate, skipSync) {
const params = {
online,
Expand All @@ -582,6 +701,23 @@ exports.Wallet = class Wallet {
);
}

sendEnd(online, signedPsbt, skipSync) {
const params = {
online,
signedPsbt,
skipSync,
};
const expectedTypes = {
online: "object",
signedPsbt: "string",
skipSync: "boolean",
};
validateTypes(params, expectedTypes);
return JSON.parse(
lib.rgblib_send_end(this.wallet, online, signedPsbt, skipSync),
);
}

signPsbt(psbt) {
const params = { psbt };
const expectedTypes = {
Expand Down