btc-wallet 0.5.47-beta → 0.5.49-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/dist/core/btcUtils.d.ts +2 -2
- package/dist/core/setupBTCWallet/index.d.ts +2 -1
- package/dist/evmSigner/index.d.ts +2 -6867
- package/dist/index.js +142 -59
- package/dist/index.js.map +2 -2
- package/dist/utils/initWalletButton.d.ts +1 -1
- package/dist/utils/nearUtils.d.ts +2 -3
- package/dist/utils/satoshi.d.ts +32 -11
- package/esm/index.js +142 -59
- package/esm/index.js.map +2 -2
- package/package.json +10 -28
@@ -4,6 +4,6 @@ interface OriginalWallet {
|
|
4
4
|
account: string | undefined;
|
5
5
|
getPublicKey: () => Promise<string | undefined>;
|
6
6
|
}
|
7
|
-
export declare function setupWalletButton(env: ENV, wallet: Wallet, originalWallet: OriginalWallet): void;
|
7
|
+
export declare function setupWalletButton(env: ENV, wallet: Wallet, originalWallet: OriginalWallet, walletUrl?: string): void;
|
8
8
|
export declare function removeWalletButton(): void;
|
9
9
|
export {};
|
@@ -1,13 +1,12 @@
|
|
1
1
|
import type { ProviderService } from '@near-wallet-selector/core/src/lib/services';
|
2
|
-
import { providers } from 'near-api-js';
|
3
2
|
export declare function getNearProvider(option: {
|
4
3
|
network?: string;
|
5
4
|
provider?: ProviderService;
|
6
|
-
}):
|
5
|
+
}): any;
|
7
6
|
export declare function nearCallFunction<T>(contractId: string, methodName: string, args: any, options?: {
|
8
7
|
network?: string;
|
9
8
|
provider?: ProviderService;
|
10
9
|
cacheTimeout?: number;
|
11
10
|
skipCache?: boolean;
|
12
11
|
}): Promise<T>;
|
13
|
-
export declare function pollTransactionStatuses(network: string, hashes: string[]): Promise<
|
12
|
+
export declare function pollTransactionStatuses(network: string, hashes: string[]): Promise<FinalExecutionOutcome[]>;
|
package/dist/utils/satoshi.d.ts
CHANGED
@@ -1,27 +1,48 @@
|
|
1
1
|
import type { Transaction } from '@near-wallet-selector/core';
|
2
2
|
import { type ENV } from '../config';
|
3
|
-
export declare function getNonce(
|
4
|
-
|
5
|
-
|
3
|
+
export declare function getNonce({ env, accountId }: {
|
4
|
+
env: ENV;
|
5
|
+
accountId: string;
|
6
|
+
}): Promise<string>;
|
7
|
+
export declare function getNearNonce({ env, accountId }: {
|
8
|
+
env: ENV;
|
9
|
+
accountId: string;
|
10
|
+
}): Promise<string>;
|
11
|
+
export declare function receiveTransaction({ env, ...data }: {
|
12
|
+
env: ENV;
|
13
|
+
} & any): Promise<any>;
|
6
14
|
interface ReceiveDepositMsgParams {
|
15
|
+
env: ENV;
|
7
16
|
btcPublicKey: string;
|
8
17
|
txHash: string;
|
9
18
|
depositType?: number;
|
10
19
|
postActions?: string;
|
11
20
|
extraMsg?: string;
|
12
21
|
}
|
13
|
-
export declare function preReceiveDepositMsg(
|
14
|
-
export declare function receiveDepositMsg(
|
15
|
-
export declare function checkBridgeTransactionStatus(
|
22
|
+
export declare function preReceiveDepositMsg({ env, btcPublicKey, depositType, postActions, extraMsg, }: Omit<ReceiveDepositMsgParams, 'txHash'>): Promise<any>;
|
23
|
+
export declare function receiveDepositMsg({ env, btcPublicKey, txHash, depositType, postActions, extraMsg, }: ReceiveDepositMsgParams): Promise<any>;
|
24
|
+
export declare function checkBridgeTransactionStatus({ txHash, fromChain, env, }: {
|
25
|
+
txHash: string;
|
26
|
+
fromChain?: 'BTC' | 'NEAR';
|
27
|
+
env: ENV;
|
28
|
+
}): Promise<{
|
16
29
|
Status: number;
|
17
30
|
ToTxHash: string;
|
18
31
|
}>;
|
19
|
-
export declare function checkBtcTransactionStatus(
|
32
|
+
export declare function checkBtcTransactionStatus({ signature, env, }: {
|
33
|
+
signature: string;
|
34
|
+
env: ENV;
|
35
|
+
}): Promise<{
|
20
36
|
Status: number;
|
21
37
|
NearHashList: string[];
|
22
38
|
}>;
|
23
|
-
export declare function getWhitelist(
|
24
|
-
|
39
|
+
export declare function getWhitelist({ env }: {
|
40
|
+
env: ENV;
|
41
|
+
}): Promise<string[]>;
|
42
|
+
export declare function receiveWithdrawMsg({ env, txHash }: {
|
43
|
+
env: ENV;
|
44
|
+
txHash: string;
|
45
|
+
}): Promise<any>;
|
25
46
|
export interface AccountInfo {
|
26
47
|
nonce: string;
|
27
48
|
gas_token: Record<string, string>;
|
@@ -71,9 +92,9 @@ export declare function convertTransactionToTxHex({ transaction, accountId, publ
|
|
71
92
|
env: ENV;
|
72
93
|
index?: number;
|
73
94
|
}): Promise<{
|
95
|
+
txBytes: Uint8Array<ArrayBufferLike>;
|
74
96
|
txHex: string;
|
75
|
-
|
76
|
-
hash: string;
|
97
|
+
hash: any;
|
77
98
|
}>;
|
78
99
|
interface CalculateGasLimitParams {
|
79
100
|
transactions: Transaction[];
|
package/esm/index.js
CHANGED
@@ -19,6 +19,18 @@ var __spreadValues = (a, b) => {
|
|
19
19
|
return a;
|
20
20
|
};
|
21
21
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
22
|
+
var __objRest = (source, exclude) => {
|
23
|
+
var target = {};
|
24
|
+
for (var prop in source)
|
25
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
26
|
+
target[prop] = source[prop];
|
27
|
+
if (source != null && __getOwnPropSymbols)
|
28
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
29
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
30
|
+
target[prop] = source[prop];
|
31
|
+
}
|
32
|
+
return target;
|
33
|
+
};
|
22
34
|
var __accessCheck = (obj, member, msg) => {
|
23
35
|
if (!member.has(obj))
|
24
36
|
throw TypeError("Cannot " + msg);
|
@@ -3142,10 +3154,11 @@ var state_default = {
|
|
3142
3154
|
};
|
3143
3155
|
|
3144
3156
|
// src/utils/satoshi.ts
|
3145
|
-
function getNonce(
|
3146
|
-
return __async(this,
|
3157
|
+
function getNonce(_0) {
|
3158
|
+
return __async(this, arguments, function* ({ env, accountId }) {
|
3159
|
+
const config = getWalletConfig(env);
|
3147
3160
|
const { result_code, result_message, result_data } = yield request(
|
3148
|
-
`${
|
3161
|
+
`${config.base_url}/v1/nonce?csna=${accountId}`
|
3149
3162
|
);
|
3150
3163
|
if (result_code !== 0) {
|
3151
3164
|
throw new Error(result_message);
|
@@ -3153,10 +3166,11 @@ function getNonce(url, accountId) {
|
|
3153
3166
|
return result_data;
|
3154
3167
|
});
|
3155
3168
|
}
|
3156
|
-
function getNearNonce(
|
3157
|
-
return __async(this,
|
3169
|
+
function getNearNonce(_0) {
|
3170
|
+
return __async(this, arguments, function* ({ env, accountId }) {
|
3171
|
+
const config = getWalletConfig(env);
|
3158
3172
|
const { result_code, result_message, result_data } = yield request(
|
3159
|
-
`${
|
3173
|
+
`${config.base_url}/v1/nonceNear?csna=${accountId}`
|
3160
3174
|
);
|
3161
3175
|
if (result_code !== 0) {
|
3162
3176
|
throw new Error(result_message);
|
@@ -3164,10 +3178,12 @@ function getNearNonce(url, accountId) {
|
|
3164
3178
|
return result_data;
|
3165
3179
|
});
|
3166
3180
|
}
|
3167
|
-
function receiveTransaction(
|
3181
|
+
function receiveTransaction(_a) {
|
3168
3182
|
return __async(this, null, function* () {
|
3183
|
+
var _b = _a, { env } = _b, data = __objRest(_b, ["env"]);
|
3184
|
+
const config = getWalletConfig(env);
|
3169
3185
|
const { result_code, result_message, result_data } = yield request(
|
3170
|
-
`${
|
3186
|
+
`${config.base_url}/v1/receiveTransaction`,
|
3171
3187
|
{
|
3172
3188
|
method: "POST",
|
3173
3189
|
body: data
|
@@ -3179,10 +3195,17 @@ function receiveTransaction(url, data) {
|
|
3179
3195
|
return result_data;
|
3180
3196
|
});
|
3181
3197
|
}
|
3182
|
-
function preReceiveDepositMsg(_0
|
3183
|
-
return __async(this, arguments, function* (
|
3198
|
+
function preReceiveDepositMsg(_0) {
|
3199
|
+
return __async(this, arguments, function* ({
|
3200
|
+
env,
|
3201
|
+
btcPublicKey,
|
3202
|
+
depositType = 1,
|
3203
|
+
postActions,
|
3204
|
+
extraMsg
|
3205
|
+
}) {
|
3206
|
+
const config = getWalletConfig(env);
|
3184
3207
|
const { result_code, result_message, result_data } = yield request(
|
3185
|
-
`${
|
3208
|
+
`${config.base_url}/v1/preReceiveDepositMsg`,
|
3186
3209
|
{
|
3187
3210
|
method: "POST",
|
3188
3211
|
body: { btcPublicKey, depositType, postActions, extraMsg }
|
@@ -3195,10 +3218,18 @@ function preReceiveDepositMsg(_0, _1) {
|
|
3195
3218
|
return result_data;
|
3196
3219
|
});
|
3197
3220
|
}
|
3198
|
-
function receiveDepositMsg(_0
|
3199
|
-
return __async(this, arguments, function* (
|
3221
|
+
function receiveDepositMsg(_0) {
|
3222
|
+
return __async(this, arguments, function* ({
|
3223
|
+
env,
|
3224
|
+
btcPublicKey,
|
3225
|
+
txHash,
|
3226
|
+
depositType = 1,
|
3227
|
+
postActions,
|
3228
|
+
extraMsg
|
3229
|
+
}) {
|
3230
|
+
const config = getWalletConfig(env);
|
3200
3231
|
const { result_code, result_message, result_data } = yield request(
|
3201
|
-
`${
|
3232
|
+
`${config.base_url}/v1/receiveDepositMsg`,
|
3202
3233
|
{
|
3203
3234
|
method: "POST",
|
3204
3235
|
body: { btcPublicKey, txHash, depositType, postActions, extraMsg }
|
@@ -3211,28 +3242,41 @@ function receiveDepositMsg(_0, _1) {
|
|
3211
3242
|
return result_data;
|
3212
3243
|
});
|
3213
3244
|
}
|
3214
|
-
function checkBridgeTransactionStatus(
|
3215
|
-
return __async(this,
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3245
|
+
function checkBridgeTransactionStatus(_0) {
|
3246
|
+
return __async(this, arguments, function* ({
|
3247
|
+
txHash,
|
3248
|
+
fromChain,
|
3249
|
+
env
|
3250
|
+
}) {
|
3251
|
+
const config = getWalletConfig(env);
|
3252
|
+
const { result_code, result_message, result_data } = yield request(
|
3253
|
+
`${config.base_url}/v1/bridgeFromTx?fromTxHash=${txHash}&fromChainId=${fromChain === "NEAR" ? 2 : 1}`,
|
3254
|
+
{
|
3255
|
+
timeout: 3 * 60 * 60 * 1e3,
|
3256
|
+
pollingInterval: 5e3,
|
3257
|
+
maxPollingAttempts: 3e3,
|
3258
|
+
shouldStopPolling: (res) => {
|
3259
|
+
var _a;
|
3260
|
+
const status = ((_a = res.result_data) == null ? void 0 : _a.Status) || 0;
|
3261
|
+
return res.result_code === 0 && (status === 4 || status >= 50);
|
3262
|
+
}
|
3224
3263
|
}
|
3225
|
-
|
3264
|
+
);
|
3226
3265
|
console.log("checkTransactionStatus resp:", { result_code, result_message, result_data });
|
3227
3266
|
if ((result_data == null ? void 0 : result_data.Status) !== 4) {
|
3228
3267
|
throw new Error(result_message || `Transaction failed, status: ${result_data == null ? void 0 : result_data.Status}`);
|
3229
3268
|
}
|
3269
|
+
console.log("checkBridgeTransactionStatus resp:", result_data);
|
3230
3270
|
return result_data;
|
3231
3271
|
});
|
3232
3272
|
}
|
3233
|
-
function checkBtcTransactionStatus(
|
3234
|
-
return __async(this,
|
3235
|
-
|
3273
|
+
function checkBtcTransactionStatus(_0) {
|
3274
|
+
return __async(this, arguments, function* ({
|
3275
|
+
signature,
|
3276
|
+
env
|
3277
|
+
}) {
|
3278
|
+
const config = getWalletConfig(env);
|
3279
|
+
const { result_code, result_message, result_data } = yield request(`${config.base_url}/v1/btcTx?sig=${toHex(signature)}`, {
|
3236
3280
|
timeout: 3e5,
|
3237
3281
|
pollingInterval: 5e3,
|
3238
3282
|
maxPollingAttempts: 60,
|
@@ -3242,16 +3286,17 @@ function checkBtcTransactionStatus(url, sig) {
|
|
3242
3286
|
return res.result_code === 0 && (status === 3 || status >= 10);
|
3243
3287
|
}
|
3244
3288
|
});
|
3245
|
-
console.log("checkBtcTransactionStatus resp:", { result_code, result_message, result_data });
|
3246
3289
|
if ((result_data == null ? void 0 : result_data.Status) !== 3) {
|
3247
3290
|
throw new Error(result_message || `Transaction failed, status: ${result_data == null ? void 0 : result_data.Status}`);
|
3248
3291
|
}
|
3292
|
+
console.log("checkBtcTransactionStatus resp:", { result_code, result_message, result_data });
|
3249
3293
|
return result_data;
|
3250
3294
|
});
|
3251
3295
|
}
|
3252
|
-
function getWhitelist(
|
3253
|
-
return __async(this,
|
3254
|
-
const
|
3296
|
+
function getWhitelist(_0) {
|
3297
|
+
return __async(this, arguments, function* ({ env }) {
|
3298
|
+
const config = getWalletConfig(env);
|
3299
|
+
const data = yield request(`${config.base_url}/v1/whitelist/users`).catch((error) => {
|
3255
3300
|
console.error("getWhitelist error:", error);
|
3256
3301
|
return [];
|
3257
3302
|
});
|
@@ -3365,7 +3410,7 @@ function convertTransactionToTxHex(_0) {
|
|
3365
3410
|
const accessKey = __spreadProps(__spreadValues({}, rawAccessKey), {
|
3366
3411
|
nonce: BigInt((rawAccessKey == null ? void 0 : rawAccessKey.nonce) || 0)
|
3367
3412
|
});
|
3368
|
-
const nearNonceFromApi = yield getNearNonce(
|
3413
|
+
const nearNonceFromApi = yield getNearNonce({ env, accountId });
|
3369
3414
|
let nearNonceNumber = accessKey.nonce + BigInt(1);
|
3370
3415
|
if (nearNonceFromApi) {
|
3371
3416
|
nearNonceNumber = BigInt(nearNonceFromApi) > nearNonceNumber ? BigInt(nearNonceFromApi) : nearNonceNumber;
|
@@ -3402,7 +3447,7 @@ function convertTransactionToTxHex(_0) {
|
|
3402
3447
|
function calculateGasLimit(params) {
|
3403
3448
|
return __async(this, null, function* () {
|
3404
3449
|
const trans = [...params.transactions];
|
3405
|
-
console.log("raw trans:", trans);
|
3450
|
+
console.log("calculateGasLimit raw trans:", trans);
|
3406
3451
|
const { gasLimit } = yield calculateGasStrategy(params);
|
3407
3452
|
return gasLimit;
|
3408
3453
|
});
|
@@ -3890,14 +3935,16 @@ function executeBTCDepositAndAction(_0) {
|
|
3890
3935
|
"Fee Rate": _feeRate
|
3891
3936
|
});
|
3892
3937
|
const postActionsStr = newActions.length > 0 ? JSON.stringify(newActions) : void 0;
|
3893
|
-
yield preReceiveDepositMsg(
|
3938
|
+
yield preReceiveDepositMsg({
|
3939
|
+
env,
|
3894
3940
|
btcPublicKey,
|
3895
3941
|
depositType: postActionsStr || depositMsg.extra_msg ? 1 : 0,
|
3896
3942
|
postActions: postActionsStr,
|
3897
3943
|
extraMsg: depositMsg.extra_msg
|
3898
3944
|
});
|
3899
3945
|
const txHash = yield sendBitcoin(userDepositAddress, depositAmount, _feeRate);
|
3900
|
-
yield receiveDepositMsg(
|
3946
|
+
yield receiveDepositMsg({
|
3947
|
+
env,
|
3901
3948
|
btcPublicKey,
|
3902
3949
|
txHash,
|
3903
3950
|
depositType: postActionsStr || depositMsg.extra_msg ? 1 : 0,
|
@@ -3907,8 +3954,11 @@ function executeBTCDepositAndAction(_0) {
|
|
3907
3954
|
if (!pollResult) {
|
3908
3955
|
return txHash;
|
3909
3956
|
}
|
3910
|
-
const checkTransactionStatusRes = yield checkBridgeTransactionStatus(
|
3911
|
-
|
3957
|
+
const checkTransactionStatusRes = yield checkBridgeTransactionStatus({
|
3958
|
+
txHash,
|
3959
|
+
fromChain: "BTC",
|
3960
|
+
env
|
3961
|
+
});
|
3912
3962
|
const network = yield getNetwork();
|
3913
3963
|
const result = yield pollTransactionStatuses(network, [checkTransactionStatusRes.ToTxHash]);
|
3914
3964
|
return result;
|
@@ -3932,8 +3982,7 @@ function checkSatoshiWhitelist(btcAccountId, env = "mainnet") {
|
|
3932
3982
|
}
|
3933
3983
|
if (!btcAccountId)
|
3934
3984
|
return;
|
3935
|
-
const
|
3936
|
-
const whitelist = yield getWhitelist(config.base_url);
|
3985
|
+
const whitelist = yield getWhitelist({ env });
|
3937
3986
|
if (!(whitelist == null ? void 0 : whitelist.length))
|
3938
3987
|
return;
|
3939
3988
|
const isWhitelisted = whitelist.includes(btcAccountId);
|
@@ -4247,13 +4296,13 @@ function uint8ArrayToHex(uint8Array) {
|
|
4247
4296
|
}
|
4248
4297
|
|
4249
4298
|
// src/utils/initWalletButton.ts
|
4250
|
-
function setupWalletButton(env, wallet, originalWallet) {
|
4251
|
-
console.log(
|
4299
|
+
function setupWalletButton(env, wallet, originalWallet, walletUrl) {
|
4300
|
+
console.log(`setupWalletButton ${walletUrl || ""}`);
|
4252
4301
|
if (document.getElementById("satoshi-wallet-button")) {
|
4253
4302
|
return;
|
4254
4303
|
}
|
4255
4304
|
const iframe = createIframe({
|
4256
|
-
iframeUrl: walletConfig[env].walletUrl,
|
4305
|
+
iframeUrl: walletUrl || walletConfig[env].walletUrl,
|
4257
4306
|
iframeStyle: { width: "400px", height: "650px" }
|
4258
4307
|
});
|
4259
4308
|
iframe.addEventListener("mouseenter", () => {
|
@@ -4298,7 +4347,8 @@ function createFloatingButtonWithIframe({
|
|
4298
4347
|
height: "60px",
|
4299
4348
|
cursor: "grab",
|
4300
4349
|
transition: "transform 0.15s ease",
|
4301
|
-
userSelect: "none"
|
4350
|
+
userSelect: "none",
|
4351
|
+
touchAction: "none"
|
4302
4352
|
});
|
4303
4353
|
document.body.appendChild(button);
|
4304
4354
|
updateIframePosition(iframe, right, bottom, windowWidth, windowHeight);
|
@@ -4309,21 +4359,41 @@ function createFloatingButtonWithIframe({
|
|
4309
4359
|
let initialBottom = 0;
|
4310
4360
|
let dragStartTime = 0;
|
4311
4361
|
button.addEventListener("mousedown", (e) => {
|
4362
|
+
startDrag(e.clientX, e.clientY);
|
4363
|
+
e.preventDefault();
|
4364
|
+
});
|
4365
|
+
button.addEventListener("touchstart", (e) => {
|
4366
|
+
if (e.touches.length === 1) {
|
4367
|
+
const touch = e.touches[0];
|
4368
|
+
startDrag(touch.clientX, touch.clientY);
|
4369
|
+
e.preventDefault();
|
4370
|
+
}
|
4371
|
+
});
|
4372
|
+
function startDrag(clientX, clientY) {
|
4312
4373
|
isDragging = true;
|
4313
|
-
startX =
|
4314
|
-
startY =
|
4374
|
+
startX = clientX;
|
4375
|
+
startY = clientY;
|
4315
4376
|
initialRight = parseInt(button.style.right);
|
4316
4377
|
initialBottom = parseInt(button.style.bottom);
|
4317
4378
|
dragStartTime = Date.now();
|
4318
4379
|
button.style.cursor = "grabbing";
|
4319
4380
|
button.style.transition = "none";
|
4320
|
-
|
4321
|
-
});
|
4381
|
+
}
|
4322
4382
|
document.addEventListener("mousemove", (e) => {
|
4323
4383
|
if (!isDragging)
|
4324
4384
|
return;
|
4325
|
-
|
4326
|
-
|
4385
|
+
moveButton(e.clientX, e.clientY);
|
4386
|
+
});
|
4387
|
+
document.addEventListener("touchmove", (e) => {
|
4388
|
+
if (!isDragging || e.touches.length !== 1)
|
4389
|
+
return;
|
4390
|
+
const touch = e.touches[0];
|
4391
|
+
moveButton(touch.clientX, touch.clientY);
|
4392
|
+
e.preventDefault();
|
4393
|
+
});
|
4394
|
+
function moveButton(clientX, clientY) {
|
4395
|
+
const deltaX = startX - clientX;
|
4396
|
+
const deltaY = startY - clientY;
|
4327
4397
|
let newRight = initialRight + deltaX;
|
4328
4398
|
let newBottom = initialBottom + deltaY;
|
4329
4399
|
newRight = Math.min(Math.max(20, newRight), windowWidth - 80);
|
@@ -4343,8 +4413,17 @@ function createFloatingButtonWithIframe({
|
|
4343
4413
|
button.style.right = `${newRight}px`;
|
4344
4414
|
button.style.bottom = `${newBottom}px`;
|
4345
4415
|
updateIframePosition(iframe, newRight, newBottom, windowWidth, windowHeight);
|
4346
|
-
}
|
4416
|
+
}
|
4347
4417
|
document.addEventListener("mouseup", () => {
|
4418
|
+
endDrag();
|
4419
|
+
});
|
4420
|
+
document.addEventListener("touchend", () => {
|
4421
|
+
endDrag();
|
4422
|
+
});
|
4423
|
+
document.addEventListener("touchcancel", () => {
|
4424
|
+
endDrag();
|
4425
|
+
});
|
4426
|
+
function endDrag() {
|
4348
4427
|
if (!isDragging)
|
4349
4428
|
return;
|
4350
4429
|
const dragEndTime = Date.now();
|
@@ -4362,7 +4441,7 @@ function createFloatingButtonWithIframe({
|
|
4362
4441
|
if (!isDragEvent) {
|
4363
4442
|
handleButtonClick();
|
4364
4443
|
}
|
4365
|
-
}
|
4444
|
+
}
|
4366
4445
|
const handleButtonClick = () => {
|
4367
4446
|
const isCurrentlyVisible = iframe.style.display === "block";
|
4368
4447
|
button.style.transform = "scale(0.8)";
|
@@ -4571,7 +4650,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4571
4650
|
if (btcPublicKey) {
|
4572
4651
|
yield getNearAccountByBtcPublicKey(btcPublicKey);
|
4573
4652
|
removeWalletButton();
|
4574
|
-
setupWalletButton(env, wallet, btcContext);
|
4653
|
+
setupWalletButton(env, wallet, btcContext, metadata.walletUrl);
|
4575
4654
|
}
|
4576
4655
|
} else {
|
4577
4656
|
removeWalletButton();
|
@@ -4734,7 +4813,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4734
4813
|
})
|
4735
4814
|
)
|
4736
4815
|
);
|
4737
|
-
const nonceFromApi = yield getNonce(
|
4816
|
+
const nonceFromApi = yield getNonce({ env, accountId: csna });
|
4738
4817
|
const nonceFromContract = (accountInfo == null ? void 0 : accountInfo.nonce) || 0;
|
4739
4818
|
const nonce = Number(nonceFromApi) > Number(nonceFromContract) ? String(nonceFromApi) : String(nonceFromContract);
|
4740
4819
|
const intention = {
|
@@ -4749,12 +4828,13 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4749
4828
|
};
|
4750
4829
|
const strIntention = JSON.stringify(intention);
|
4751
4830
|
const signature = yield btcContext.signMessage(strIntention);
|
4752
|
-
yield receiveTransaction(
|
4831
|
+
yield receiveTransaction({
|
4832
|
+
env,
|
4753
4833
|
sig: signature,
|
4754
4834
|
btcPubKey: state_default.getBtcPublicKey(),
|
4755
4835
|
data: toHex(strIntention)
|
4756
4836
|
});
|
4757
|
-
yield checkBtcTransactionStatus(
|
4837
|
+
yield checkBtcTransactionStatus({ signature, env });
|
4758
4838
|
const hash = newTrans.slice(1).map((t) => t.hash);
|
4759
4839
|
console.log("txHash:", hash);
|
4760
4840
|
const result = yield pollTransactionStatuses(options.network.networkId, hash);
|
@@ -4783,7 +4863,8 @@ function setupBTCWallet({
|
|
4783
4863
|
deprecated = false,
|
4784
4864
|
autoConnect = true,
|
4785
4865
|
syncLogOut = true,
|
4786
|
-
env = "mainnet"
|
4866
|
+
env = "mainnet",
|
4867
|
+
walletUrl
|
4787
4868
|
} = {}) {
|
4788
4869
|
console.log("\u26A1\uFE0F BTC Wallet Version:", getVersion(), "env:", env);
|
4789
4870
|
const btcWallet = () => __async(this, null, function* () {
|
@@ -4799,7 +4880,8 @@ function setupBTCWallet({
|
|
4799
4880
|
available: true,
|
4800
4881
|
autoConnect,
|
4801
4882
|
syncLogOut,
|
4802
|
-
env
|
4883
|
+
env,
|
4884
|
+
walletUrl
|
4803
4885
|
},
|
4804
4886
|
init: BTCWallet
|
4805
4887
|
};
|
@@ -4883,7 +4965,7 @@ function getGroup(state) {
|
|
4883
4965
|
|
4884
4966
|
// src/index.ts
|
4885
4967
|
var getVersion = () => {
|
4886
|
-
return "0.5.
|
4968
|
+
return "0.5.49-beta";
|
4887
4969
|
};
|
4888
4970
|
if (typeof window !== "undefined") {
|
4889
4971
|
window.__BTC_WALLET_VERSION = getVersion();
|
@@ -4906,6 +4988,7 @@ export {
|
|
4906
4988
|
calculateGasFee,
|
4907
4989
|
calculateGasLimit,
|
4908
4990
|
calculateWithdraw,
|
4991
|
+
checkBridgeTransactionStatus,
|
4909
4992
|
checkGasTokenDebt,
|
4910
4993
|
checkSatoshiWhitelist,
|
4911
4994
|
estimateDepositAmount,
|