Skip to content

Commit

Permalink
feat: update wasm files from main branch with manually created for brc20
Browse files Browse the repository at this point in the history
  • Loading branch information
okovalov committed Jan 6, 2024
1 parent 65678c7 commit 24e982f
Show file tree
Hide file tree
Showing 14 changed files with 357 additions and 242 deletions.
12 changes: 8 additions & 4 deletions bundler/wasm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,10 @@ export class TransactionBuilder {
* @param am: amount to pay
* @param kp: owner's XfrKeyPair
* @param {XfrKeyPair} kp
* @param {string | undefined} memo
* @returns {TransactionBuilder}
*/
add_fee_relative_auto(kp: XfrKeyPair): TransactionBuilder;
add_fee_relative_auto(kp: XfrKeyPair, memo?: string): TransactionBuilder;
/**
* Use this func to get the necessary infomations for generating `Relative Inputs`
*
Expand All @@ -966,9 +967,10 @@ export class TransactionBuilder {
* As the last operation of any transaction,
* add a static fee to the transaction.
* @param {FeeInputs} inputs
* @param {string | undefined} memo
* @returns {TransactionBuilder}
*/
add_fee(inputs: FeeInputs): TransactionBuilder;
add_fee(inputs: FeeInputs, memo?: string): TransactionBuilder;
/**
* A simple fee checker for mainnet v1.0.
*
Expand Down Expand Up @@ -1214,9 +1216,10 @@ export class TransferOperationBuilder {
* @param {string} code
* @param {boolean} conf_amount
* @param {boolean} conf_type
* @param {string | undefined} memo
* @returns {TransferOperationBuilder}
*/
add_output_with_tracing(amount: bigint, recipient: XfrPublicKey, tracing_policies: TracingPolicies, code: string, conf_amount: boolean, conf_type: boolean): TransferOperationBuilder;
add_output_with_tracing(amount: bigint, recipient: XfrPublicKey, tracing_policies: TracingPolicies, code: string, conf_amount: boolean, conf_type: boolean, memo?: string): TransferOperationBuilder;
/**
* Wraps around TransferOperationBuilder to add an output to a transfer operation builder.
*
Expand All @@ -1231,9 +1234,10 @@ export class TransferOperationBuilder {
* @param {string} code
* @param {boolean} conf_amount
* @param {boolean} conf_type
* @param {string | undefined} memo
* @returns {TransferOperationBuilder}
*/
add_output_no_tracing(amount: bigint, recipient: XfrPublicKey, code: string, conf_amount: boolean, conf_type: boolean): TransferOperationBuilder;
add_output_no_tracing(amount: bigint, recipient: XfrPublicKey, code: string, conf_amount: boolean, conf_type: boolean, memo?: string): TransferOperationBuilder;
/**
* Wraps around TransferOperationBuilder to ensure the transfer inputs and outputs are balanced.
* This function will add change outputs for all unspent portions of input records.
Expand Down
130 changes: 71 additions & 59 deletions bundler/wasm_bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,6 @@ export function __wbg_set_wasm(val) {
}


const heap = new Array(128).fill(undefined);

heap.push(undefined, null, true, false);

function getObject(idx) { return heap[idx]; }

let heap_next = heap.length;

function dropObject(idx) {
if (idx < 132) return;
heap[idx] = heap_next;
heap_next = idx;
}

function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}

const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;

let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
Expand All @@ -43,6 +23,12 @@ function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}

const heap = new Array(128).fill(undefined);

heap.push(undefined, null, true, false);

let heap_next = heap.length;

function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
Expand All @@ -52,6 +38,8 @@ function addHeapObject(obj) {
return idx;
}

function getObject(idx) { return heap[idx]; }

let WASM_VECTOR_LEN = 0;

const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
Expand Down Expand Up @@ -118,6 +106,18 @@ function getInt32Memory0() {
return cachedInt32Memory0;
}

function dropObject(idx) {
if (idx < 132) return;
heap[idx] = heap_next;
heap_next = idx;
}

function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}

function debugString(val) {
// primitive types
const type = typeof val;
Expand Down Expand Up @@ -2762,15 +2762,18 @@ export class TransactionBuilder {
* @param am: amount to pay
* @param kp: owner's XfrKeyPair
* @param {XfrKeyPair} kp
* @param {string | undefined} memo
* @returns {TransactionBuilder}
*/
add_fee_relative_auto(kp) {
add_fee_relative_auto(kp, memo) {
try {
const ptr = this.__destroy_into_raw();
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(kp, XfrKeyPair);
var ptr0 = kp.__destroy_into_raw();
wasm.transactionbuilder_add_fee_relative_auto(retptr, ptr, ptr0);
var ptr1 = isLikeNone(memo) ? 0 : passStringToWasm0(memo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
wasm.transactionbuilder_add_fee_relative_auto(retptr, ptr, ptr0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
Expand Down Expand Up @@ -2806,15 +2809,18 @@ export class TransactionBuilder {
* As the last operation of any transaction,
* add a static fee to the transaction.
* @param {FeeInputs} inputs
* @param {string | undefined} memo
* @returns {TransactionBuilder}
*/
add_fee(inputs) {
add_fee(inputs, memo) {
try {
const ptr = this.__destroy_into_raw();
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(inputs, FeeInputs);
var ptr0 = inputs.__destroy_into_raw();
wasm.transactionbuilder_add_fee(retptr, ptr, ptr0);
var ptr1 = isLikeNone(memo) ? 0 : passStringToWasm0(memo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
wasm.transactionbuilder_add_fee(retptr, ptr, ptr0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
Expand Down Expand Up @@ -3434,17 +3440,20 @@ export class TransferOperationBuilder {
* @param {string} code
* @param {boolean} conf_amount
* @param {boolean} conf_type
* @param {string | undefined} memo
* @returns {TransferOperationBuilder}
*/
add_output_with_tracing(amount, recipient, tracing_policies, code, conf_amount, conf_type) {
add_output_with_tracing(amount, recipient, tracing_policies, code, conf_amount, conf_type, memo) {
try {
const ptr = this.__destroy_into_raw();
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(recipient, XfrPublicKey);
_assertClass(tracing_policies, TracingPolicies);
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.transferoperationbuilder_add_output_with_tracing(retptr, ptr, amount, recipient.ptr, tracing_policies.ptr, ptr0, len0, conf_amount, conf_type);
var ptr1 = isLikeNone(memo) ? 0 : passStringToWasm0(memo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
wasm.transferoperationbuilder_add_output_with_tracing(retptr, ptr, amount, recipient.ptr, tracing_policies.ptr, ptr0, len0, conf_amount, conf_type, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
Expand All @@ -3470,16 +3479,19 @@ export class TransferOperationBuilder {
* @param {string} code
* @param {boolean} conf_amount
* @param {boolean} conf_type
* @param {string | undefined} memo
* @returns {TransferOperationBuilder}
*/
add_output_no_tracing(amount, recipient, code, conf_amount, conf_type) {
add_output_no_tracing(amount, recipient, code, conf_amount, conf_type, memo) {
try {
const ptr = this.__destroy_into_raw();
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(recipient, XfrPublicKey);
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.transferoperationbuilder_add_output_no_tracing(retptr, ptr, amount, recipient.ptr, ptr0, len0, conf_amount, conf_type);
var ptr1 = isLikeNone(memo) ? 0 : passStringToWasm0(memo, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len1 = WASM_VECTOR_LEN;
wasm.transferoperationbuilder_add_output_no_tracing(retptr, ptr, amount, recipient.ptr, ptr0, len0, conf_amount, conf_type, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var r2 = getInt32Memory0()[retptr / 4 + 2];
Expand Down Expand Up @@ -3805,12 +3817,8 @@ export class ZorroScalar {
}
}

export function __wbindgen_object_drop_ref(arg0) {
takeObject(arg0);
};

export function __wbindgen_string_new(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
export function __wbindgen_json_parse(arg0, arg1) {
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
};

Expand All @@ -3823,22 +3831,34 @@ export function __wbindgen_json_serialize(arg0, arg1) {
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};

export function __wbindgen_json_parse(arg0, arg1) {
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
export function __wbindgen_object_drop_ref(arg0) {
takeObject(arg0);
};

export function __wbg_now_c644db5194be8437(arg0) {
const ret = getObject(arg0).now();
return ret;
export function __wbindgen_string_new(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};

export function __wbindgen_object_clone_ref(arg0) {
const ret = getObject(arg0);
return addHeapObject(ret);
};

export function __wbg_crypto_58f13aa23ffcb166(arg0) {
export function __wbg_now_c644db5194be8437(arg0) {
const ret = getObject(arg0).now();
return ret;
};

export function __wbg_getRandomValues_37fa2ca9e4e07fab() { return handleError(function (arg0, arg1) {
getObject(arg0).getRandomValues(getObject(arg1));
}, arguments) };

export function __wbg_randomFillSync_dc1e9a60c158336d() { return handleError(function (arg0, arg1) {
getObject(arg0).randomFillSync(takeObject(arg1));
}, arguments) };

export function __wbg_crypto_c48a774b022d20ac(arg0) {
const ret = getObject(arg0).crypto;
return addHeapObject(ret);
};
Expand All @@ -3849,17 +3869,17 @@ export function __wbindgen_is_object(arg0) {
return ret;
};

export function __wbg_process_5b786e71d465a513(arg0) {
export function __wbg_process_298734cf255a885d(arg0) {
const ret = getObject(arg0).process;
return addHeapObject(ret);
};

export function __wbg_versions_c2ab80650590b6a2(arg0) {
export function __wbg_versions_e2e78e134e3e5d01(arg0) {
const ret = getObject(arg0).versions;
return addHeapObject(ret);
};

export function __wbg_node_523d7bd03ef69fba(arg0) {
export function __wbg_node_1cd7a5d853dbea79(arg0) {
const ret = getObject(arg0).node;
return addHeapObject(ret);
};
Expand All @@ -3869,12 +3889,12 @@ export function __wbindgen_is_string(arg0) {
return ret;
};

export function __wbg_msCrypto_abcb1295e768d1f2(arg0) {
export function __wbg_msCrypto_bcb970640f50a1e8(arg0) {
const ret = getObject(arg0).msCrypto;
return addHeapObject(ret);
};

export function __wbg_require_2784e593a4674877() { return handleError(function () {
export function __wbg_require_8f08ceecec0f4fee() { return handleError(function () {
const ret = module.require;
return addHeapObject(ret);
}, arguments) };
Expand All @@ -3884,13 +3904,13 @@ export function __wbindgen_is_function(arg0) {
return ret;
};

export function __wbg_randomFillSync_a0d98aa11c81fe89() { return handleError(function (arg0, arg1) {
getObject(arg0).randomFillSync(takeObject(arg1));
}, arguments) };
export function __wbg_randomFillSync_85b3f4c52c56c313(arg0, arg1, arg2) {
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
};

export function __wbg_getRandomValues_504510b5564925af() { return handleError(function (arg0, arg1) {
export function __wbg_getRandomValues_cd175915511f705e(arg0, arg1) {
getObject(arg0).getRandomValues(getObject(arg1));
}, arguments) };
};

export function __wbg_self_7eede1f4488bf346() { return handleError(function () {
const ret = self.self;
Expand Down Expand Up @@ -3927,14 +3947,6 @@ export function __wbg_getRandomValues_307049345d0bd88c(arg0) {
return addHeapObject(ret);
};

export function __wbg_getRandomValues_cd175915511f705e(arg0, arg1) {
getObject(arg0).getRandomValues(getObject(arg1));
};

export function __wbg_randomFillSync_85b3f4c52c56c313(arg0, arg1, arg2) {
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
};

export function __wbg_newnoargs_2b8b6bd7753c76ba(arg0, arg1) {
const ret = new Function(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
Expand Down
Binary file modified bundler/wasm_bg.wasm
Binary file not shown.
28 changes: 14 additions & 14 deletions bundler/wasm_bg.wasm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export function __wbg_feeinputs_free(a: number): void;
export function feeinputs_new(): number;
export function feeinputs_append(a: number, b: number, c: number, d: number, e: number, f: number): void;
export function feeinputs_append2(a: number, b: number, c: number, d: number, e: number, f: number): number;
export function transactionbuilder_add_fee_relative_auto(a: number, b: number, c: number): void;
export function transactionbuilder_add_fee_relative_auto(a: number, b: number, c: number, d: number, e: number): void;
export function transactionbuilder_get_relative_outputs(a: number, b: number): void;
export function transactionbuilder_add_fee(a: number, b: number, c: number): void;
export function transactionbuilder_add_fee(a: number, b: number, c: number, d: number, e: number): void;
export function transactionbuilder_check_fee(a: number): number;
export function transactionbuilder_new(a: number): number;
export function transactionbuilder_add_operation_create_asset(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): void;
Expand Down Expand Up @@ -43,8 +43,8 @@ export function __wbg_transferoperationbuilder_free(a: number): void;
export function transferoperationbuilder_new(): number;
export function transferoperationbuilder_add_input_with_tracing(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): void;
export function transferoperationbuilder_add_input_no_tracing(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void;
export function transferoperationbuilder_add_output_with_tracing(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number): void;
export function transferoperationbuilder_add_output_no_tracing(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): void;
export function transferoperationbuilder_add_output_with_tracing(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number): void;
export function transferoperationbuilder_add_output_no_tracing(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void;
export function transferoperationbuilder_balance(a: number, b: number): void;
export function transferoperationbuilder_create(a: number, b: number): void;
export function transferoperationbuilder_sign(a: number, b: number, c: number): void;
Expand Down Expand Up @@ -149,22 +149,22 @@ export function assetrules_set_decimals(a: number, b: number, c: number): void;
export function __wbg_credentialsignature_free(a: number): void;
export function __wbg_xpublickey_free(a: number): void;
export function __wbg_xsecretkey_free(a: number): void;
export function __wbg_blsg2_free(a: number): void;
export function __wbg_blsscalar_free(a: number): void;
export function __wbg_blsg1_free(a: number): void;
export function __wbg_secp256k1g1_free(a: number): void;
export function __wbg_jubjubscalar_free(a: number): void;
export function __wbg_zorrog1_free(a: number): void;
export function __wbg_ed25519scalar_free(a: number): void;
export function __wbg_zorrofq_free(a: number): void;
export function __wbg_secq256k1g1_free(a: number): void;
export function __wbg_zorroscalar_free(a: number): void;
export function __wbg_zorrog1_free(a: number): void;
export function __wbg_blsg1_free(a: number): void;
export function __wbg_blsg2_free(a: number): void;
export function __wbg_secp256k1g1_free(a: number): void;
export function __wbg_ed25519point_free(a: number): void;
export function __wbg_blsscalar_free(a: number): void;
export function __wbg_secq256k1scalar_free(a: number): void;
export function __wbg_secp256k1scalar_free(a: number): void;
export function __wbg_blsfq_free(a: number): void;
export function __wbg_blsgt_free(a: number): void;
export function __wbg_ed25519point_free(a: number): void;
export function ring_core_0_17_6_bn_mul_mont(a: number, b: number, c: number, d: number, e: number, f: number): void;
export function __wbg_ed25519scalar_free(a: number): void;
export function __wbg_zorroscalar_free(a: number): void;
export function __wbg_jubjubscalar_free(a: number): void;
export function ring_core_0_17_5_bn_mul_mont(a: number, b: number, c: number, d: number, e: number, f: number): void;
export function __wbg_credissuersecretkey_free(a: number): void;
export function __wbg_credissuerpublickey_free(a: number): void;
export function __wbg_creduserpublickey_free(a: number): void;
Expand Down
Loading

0 comments on commit 24e982f

Please sign in to comment.