btc-wallet 0.5.33-beta → 0.5.35-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/core/btcUtils.d.ts +3 -1
- package/dist/index.js +9 -10
- package/dist/index.js.map +2 -2
- package/esm/index.js +9 -10
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
@@ -76,6 +76,7 @@ interface ExecuteBTCDepositAndActionParams<T extends boolean = true> {
|
|
76
76
|
pollResult?: T; // optional: whether to poll for transaction result
|
77
77
|
registerDeposit?: string; // optional: whether to register deposit,default 0.000125 NEAR
|
78
78
|
newAccountMinDepositAmount?: boolean; // default is true, if true, new account minimum deposit BTC amount 1000sat, otherwise 0
|
79
|
+
registerContractId?: string; // if registerContractId is provided, it will be used to register the contract, otherwise it will be the default contract id
|
79
80
|
}
|
80
81
|
|
81
82
|
// Example 1: dApp one-click BTC deposit
|
package/dist/core/btcUtils.d.ts
CHANGED
@@ -52,12 +52,14 @@ interface ExecuteBTCDepositAndActionParams<T extends boolean = true> {
|
|
52
52
|
env?: ENV;
|
53
53
|
pollResult?: T;
|
54
54
|
newAccountMinDepositAmount?: boolean;
|
55
|
+
/** if registerContractId is provided, it will be used to register the contract, otherwise it will be the default contract id */
|
56
|
+
registerContractId?: string;
|
55
57
|
}
|
56
58
|
/**
|
57
59
|
* @param T - if true, return the poll result, otherwise return the btcTxHash
|
58
60
|
*/
|
59
61
|
type ExecuteBTCDepositAndActionReturn<T extends boolean> = T extends true ? FinalExecutionOutcome[] : string;
|
60
|
-
export declare function executeBTCDepositAndAction<T extends boolean = true>({ action, amount, feeRate, pollResult, registerDeposit, env, newAccountMinDepositAmount, }: ExecuteBTCDepositAndActionParams<T>): Promise<ExecuteBTCDepositAndActionReturn<T>>;
|
62
|
+
export declare function executeBTCDepositAndAction<T extends boolean = true>({ action, amount, feeRate, pollResult, registerDeposit, env, newAccountMinDepositAmount, registerContractId, }: ExecuteBTCDepositAndActionParams<T>): Promise<ExecuteBTCDepositAndActionReturn<T>>;
|
61
63
|
export declare function checkSatoshiWhitelist(btcAccountId: string, env?: ENV): Promise<void>;
|
62
64
|
interface WithdrawParams {
|
63
65
|
amount: string | number;
|
package/dist/index.js
CHANGED
@@ -4053,7 +4053,8 @@ function executeBTCDepositAndAction(_0) {
|
|
4053
4053
|
pollResult = true,
|
4054
4054
|
registerDeposit,
|
4055
4055
|
env = "mainnet",
|
4056
|
-
newAccountMinDepositAmount
|
4056
|
+
newAccountMinDepositAmount,
|
4057
|
+
registerContractId
|
4057
4058
|
}) {
|
4058
4059
|
var _a;
|
4059
4060
|
try {
|
@@ -4091,17 +4092,14 @@ function executeBTCDepositAndAction(_0) {
|
|
4091
4092
|
}));
|
4092
4093
|
}
|
4093
4094
|
const storageDepositMsg = {};
|
4094
|
-
const
|
4095
|
-
|
4096
|
-
|
4097
|
-
);
|
4098
|
-
console.log("executeBTCDepositAndAction registerContractId", registerContractId);
|
4099
|
-
const registerRes = yield nearCall(registerContractId, "storage_balance_of", {
|
4095
|
+
const _registerContractId = registerContractId || ((action == null ? void 0 : action.receiver_id) || config.btcToken).replace(config.accountContractId, config.btcToken);
|
4096
|
+
console.log("executeBTCDepositAndAction registerContractId", _registerContractId);
|
4097
|
+
const registerRes = yield nearCall(_registerContractId, "storage_balance_of", {
|
4100
4098
|
account_id: csna
|
4101
4099
|
});
|
4102
4100
|
if (!(registerRes == null ? void 0 : registerRes.available)) {
|
4103
4101
|
storageDepositMsg.storage_deposit_msg = {
|
4104
|
-
contract_id:
|
4102
|
+
contract_id: _registerContractId,
|
4105
4103
|
deposit: registerDeposit || NEAR_STORAGE_DEPOSIT_AMOUNT,
|
4106
4104
|
registration_only: true
|
4107
4105
|
};
|
@@ -4790,7 +4788,8 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4790
4788
|
gas_token: currentConfig.btcToken,
|
4791
4789
|
gas_limit: gasLimit,
|
4792
4790
|
use_near_pay_gas: useNearPayGas,
|
4793
|
-
nonce
|
4791
|
+
nonce,
|
4792
|
+
replace: true
|
4794
4793
|
};
|
4795
4794
|
const strIntention = JSON.stringify(intention);
|
4796
4795
|
const signature = yield btcContext.signMessage(strIntention);
|
@@ -4926,7 +4925,7 @@ function getGroup(state) {
|
|
4926
4925
|
|
4927
4926
|
// src/index.ts
|
4928
4927
|
var getVersion = () => {
|
4929
|
-
return "0.5.
|
4928
|
+
return "0.5.35-beta";
|
4930
4929
|
};
|
4931
4930
|
if (typeof window !== "undefined") {
|
4932
4931
|
window.__BTC_WALLET_VERSION = getVersion();
|