@hot-labs/kit 1.1.0-beta.3 → 1.1.0-beta.5
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/build/OmniConnector.d.ts +1 -0
- package/build/OmniConnector.js.map +1 -1
- package/build/core/Intents.d.ts +21 -6
- package/build/core/Intents.js +81 -46
- package/build/core/Intents.js.map +1 -1
- package/build/core/api.d.ts +16 -1
- package/build/core/api.js +14 -4
- package/build/core/api.js.map +1 -1
- package/build/cosmos/connector.d.ts +2 -2
- package/build/cosmos/connector.js +15 -19
- package/build/cosmos/connector.js.map +1 -1
- package/build/cosmos/wallet.js.map +1 -1
- package/build/exchange.js +1 -5
- package/build/exchange.js.map +1 -1
- package/build/solana/wallet.js +1 -1
- package/build/solana/wallet.js.map +1 -1
- package/build/ui/Popup.d.ts +1 -1
- package/build/ui/Popup.js +1 -1
- package/build/ui/Popup.js.map +1 -1
- package/build/ui/payment/Payment.d.ts +7 -15
- package/build/ui/payment/Payment.js +47 -61
- package/build/ui/payment/Payment.js.map +1 -1
- package/build/ui/payment/Stepper.d.ts +13 -0
- package/build/ui/payment/Stepper.js +22 -0
- package/build/ui/payment/Stepper.js.map +1 -0
- package/build/ui/router.d.ts +6 -3
- package/build/ui/router.js +6 -6
- package/build/ui/router.js.map +1 -1
- package/package.json +1 -1
- package/src/OmniConnector.ts +1 -0
- package/src/core/Intents.ts +92 -46
- package/src/core/api.ts +26 -4
- package/src/cosmos/connector.ts +20 -24
- package/src/cosmos/wallet.ts +0 -1
- package/src/exchange.ts +2 -5
- package/src/solana/wallet.ts +1 -2
- package/src/ui/Popup.tsx +7 -4
- package/src/ui/payment/Payment.tsx +77 -106
- package/src/ui/payment/Stepper.tsx +50 -0
- package/src/ui/router.tsx +13 -11
package/package.json
CHANGED
package/src/OmniConnector.ts
CHANGED
package/src/core/Intents.ts
CHANGED
|
@@ -21,14 +21,20 @@ export class Intents {
|
|
|
21
21
|
return new Intents();
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
intents: Intent[] = [];
|
|
26
|
-
signer?: OmniWallet;
|
|
27
|
-
nonce?: Uint8Array;
|
|
28
|
-
deadline?: Date;
|
|
29
|
-
|
|
24
|
+
signedHashes: string[] = [];
|
|
30
25
|
commitments: Commitment[] = [];
|
|
31
26
|
need = new Map<OmniToken, bigint>();
|
|
27
|
+
signer?: OmniWallet;
|
|
28
|
+
|
|
29
|
+
unsignedCommitment: {
|
|
30
|
+
intents: Intent[];
|
|
31
|
+
nonce?: Uint8Array;
|
|
32
|
+
deadline?: Date;
|
|
33
|
+
} = {
|
|
34
|
+
intents: [],
|
|
35
|
+
nonce: undefined,
|
|
36
|
+
deadline: undefined,
|
|
37
|
+
};
|
|
32
38
|
|
|
33
39
|
addNeed(token: OmniToken, amount: bigint) {
|
|
34
40
|
if (!this.need.has(token)) this.need.set(token, 0n);
|
|
@@ -38,7 +44,7 @@ export class Intents {
|
|
|
38
44
|
|
|
39
45
|
authCall(args: { contractId: string; msg: string; attachNear: bigint; tgas: number }) {
|
|
40
46
|
this.addNeed(OmniToken.NEAR, args.attachNear);
|
|
41
|
-
this.intents.push({
|
|
47
|
+
this.unsignedCommitment.intents.push({
|
|
42
48
|
min_gas: (BigInt(args.tgas) * TGAS).toString(),
|
|
43
49
|
attached_deposit: args.attachNear.toString(),
|
|
44
50
|
contract_id: args.contractId,
|
|
@@ -49,6 +55,18 @@ export class Intents {
|
|
|
49
55
|
return this;
|
|
50
56
|
}
|
|
51
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Use this method to pay for a merchant's item created in pay.hot-labs.org
|
|
60
|
+
*/
|
|
61
|
+
merchantPayment({ merchantId, token, itemId, email, amount, memo }: { token: OmniToken; merchantId: string; itemId: string; amount: number | bigint; memo: string; email: string }) {
|
|
62
|
+
return this.transfer({
|
|
63
|
+
msg: JSON.stringify({ merchant_id: merchantId, item_id: itemId, memo: memo }),
|
|
64
|
+
recipient: "pay.fi.tg",
|
|
65
|
+
amount,
|
|
66
|
+
token,
|
|
67
|
+
}).yieldExecute({ email });
|
|
68
|
+
}
|
|
69
|
+
|
|
52
70
|
transfer(args: { recipient: string; token: OmniToken; amount: number | bigint; memo?: string; msg?: string; tgas?: number }) {
|
|
53
71
|
const omniToken = tokens.get(args.token);
|
|
54
72
|
const amount = (typeof args.amount === "number" ? omniToken.int(args.amount) : args.amount).toString();
|
|
@@ -62,7 +80,7 @@ export class Intents {
|
|
|
62
80
|
};
|
|
63
81
|
|
|
64
82
|
this.addNeed(args.token, BigInt(amount));
|
|
65
|
-
this.intents.push(intent);
|
|
83
|
+
this.unsignedCommitment.intents.push(intent);
|
|
66
84
|
return this;
|
|
67
85
|
}
|
|
68
86
|
|
|
@@ -84,7 +102,7 @@ export class Intents {
|
|
|
84
102
|
msg: args.msg,
|
|
85
103
|
};
|
|
86
104
|
|
|
87
|
-
this.intents.push(intent);
|
|
105
|
+
this.unsignedCommitment.intents.push(intent);
|
|
88
106
|
return this;
|
|
89
107
|
}
|
|
90
108
|
|
|
@@ -107,7 +125,7 @@ export class Intents {
|
|
|
107
125
|
}
|
|
108
126
|
}
|
|
109
127
|
|
|
110
|
-
this.intents.push(intent);
|
|
128
|
+
this.unsignedCommitment.intents.push(intent);
|
|
111
129
|
return this;
|
|
112
130
|
}
|
|
113
131
|
|
|
@@ -144,7 +162,7 @@ export class Intents {
|
|
|
144
162
|
this.addNeed(token, BigInt(rawIntent.amounts[i]));
|
|
145
163
|
}
|
|
146
164
|
|
|
147
|
-
this.intents.push({
|
|
165
|
+
this.unsignedCommitment.intents.push({
|
|
148
166
|
intent: "mt_withdraw",
|
|
149
167
|
amounts: rawIntent.amounts,
|
|
150
168
|
receiver_id: rawIntent.receiver_id,
|
|
@@ -199,12 +217,12 @@ export class Intents {
|
|
|
199
217
|
}
|
|
200
218
|
|
|
201
219
|
addPublicKey(publicKey: string) {
|
|
202
|
-
this.intents.push({ intent: "add_public_key", public_key: publicKey });
|
|
220
|
+
this.unsignedCommitment.intents.push({ intent: "add_public_key", public_key: publicKey });
|
|
203
221
|
return this;
|
|
204
222
|
}
|
|
205
223
|
|
|
206
224
|
removePublicKey(publicKey: string) {
|
|
207
|
-
this.intents.push({ intent: "remove_public_key", public_key: publicKey });
|
|
225
|
+
this.unsignedCommitment.intents.push({ intent: "remove_public_key", public_key: publicKey });
|
|
208
226
|
return this;
|
|
209
227
|
}
|
|
210
228
|
|
|
@@ -217,7 +235,7 @@ export class Intents {
|
|
|
217
235
|
if (standart === "nep245") {
|
|
218
236
|
const mtContract = tokenParts[0];
|
|
219
237
|
const tokenId = tokenParts.slice(1).join(":");
|
|
220
|
-
this.intents.push({
|
|
238
|
+
this.unsignedCommitment.intents.push({
|
|
221
239
|
intent: "mt_withdraw",
|
|
222
240
|
amounts: [amount],
|
|
223
241
|
receiver_id: args.receiver,
|
|
@@ -231,7 +249,7 @@ export class Intents {
|
|
|
231
249
|
}
|
|
232
250
|
|
|
233
251
|
if (standart === "nep141") {
|
|
234
|
-
this.intents.push({
|
|
252
|
+
this.unsignedCommitment.intents.push({
|
|
235
253
|
intent: "ft_withdraw",
|
|
236
254
|
receiver_id: args.receiver,
|
|
237
255
|
token: tokenParts.join(":"),
|
|
@@ -243,7 +261,7 @@ export class Intents {
|
|
|
243
261
|
}
|
|
244
262
|
|
|
245
263
|
if (standart === "nep171") {
|
|
246
|
-
this.intents.push({
|
|
264
|
+
this.unsignedCommitment.intents.push({
|
|
247
265
|
intent: "nft_withdraw",
|
|
248
266
|
receiver_id: args.receiver,
|
|
249
267
|
token_id: tokenParts.join(":"),
|
|
@@ -258,7 +276,7 @@ export class Intents {
|
|
|
258
276
|
}
|
|
259
277
|
|
|
260
278
|
attachHashes(hashes: string[]) {
|
|
261
|
-
this.
|
|
279
|
+
this.signedHashes.push(...hashes);
|
|
262
280
|
return this;
|
|
263
281
|
}
|
|
264
282
|
|
|
@@ -268,22 +286,22 @@ export class Intents {
|
|
|
268
286
|
}
|
|
269
287
|
|
|
270
288
|
attachDeadline(deadline: Date) {
|
|
271
|
-
this.deadline = deadline;
|
|
289
|
+
this.unsignedCommitment.deadline = deadline;
|
|
272
290
|
return this;
|
|
273
291
|
}
|
|
274
292
|
|
|
275
293
|
attachNonce(nonce: Uint8Array) {
|
|
276
|
-
this.nonce = nonce;
|
|
294
|
+
this.unsignedCommitment.nonce = nonce;
|
|
277
295
|
return this;
|
|
278
296
|
}
|
|
279
297
|
|
|
280
298
|
attachTimeout(seconds: number) {
|
|
281
|
-
this.deadline = new Date(Date.now() + seconds * 1000);
|
|
299
|
+
this.unsignedCommitment.deadline = new Date(Date.now() + seconds * 1000);
|
|
282
300
|
return this;
|
|
283
301
|
}
|
|
284
302
|
|
|
285
303
|
attachSeed(seed: string) {
|
|
286
|
-
this.nonce = new Uint8Array(sha256(new TextEncoder().encode(seed))).slice(0, 32);
|
|
304
|
+
this.unsignedCommitment.nonce = new Uint8Array(sha256(new TextEncoder().encode(seed))).slice(0, 32);
|
|
287
305
|
return this;
|
|
288
306
|
}
|
|
289
307
|
|
|
@@ -296,10 +314,10 @@ export class Intents {
|
|
|
296
314
|
const intAmount = typeof amount === "number" ? tokens.get(token).int(amount) : amount;
|
|
297
315
|
|
|
298
316
|
// this.addNeed(token, -intAmount); Do we need to add the need here?
|
|
299
|
-
const tokenDiff = this.intents.find((intent) => intent.intent === "token_diff");
|
|
317
|
+
const tokenDiff = this.unsignedCommitment.intents.find((intent) => intent.intent === "token_diff");
|
|
300
318
|
|
|
301
319
|
if (tokenDiff) tokenDiff.diff[token.toString()] = intAmount.toString();
|
|
302
|
-
else this.intents.push({ intent: "token_diff", diff: { [token.toString()]: intAmount.toString() } });
|
|
320
|
+
else this.unsignedCommitment.intents.push({ intent: "token_diff", diff: { [token.toString()]: intAmount.toString() } });
|
|
303
321
|
return this;
|
|
304
322
|
}
|
|
305
323
|
|
|
@@ -307,10 +325,10 @@ export class Intents {
|
|
|
307
325
|
const intAmount = typeof amount === "number" ? tokens.get(token).int(amount) : amount;
|
|
308
326
|
|
|
309
327
|
this.addNeed(token as OmniToken, intAmount);
|
|
310
|
-
const tokenDiff = this.intents.find((intent) => intent.intent === "token_diff");
|
|
328
|
+
const tokenDiff = this.unsignedCommitment.intents.find((intent) => intent.intent === "token_diff");
|
|
311
329
|
|
|
312
330
|
if (tokenDiff) tokenDiff.diff[token.toString()] = (-intAmount).toString();
|
|
313
|
-
else this.intents.push({ intent: "token_diff", diff: { [token.toString()]: (-intAmount).toString() } });
|
|
331
|
+
else this.unsignedCommitment.intents.push({ intent: "token_diff", diff: { [token.toString()]: (-intAmount).toString() } });
|
|
314
332
|
return this;
|
|
315
333
|
}
|
|
316
334
|
|
|
@@ -320,9 +338,13 @@ export class Intents {
|
|
|
320
338
|
if (!signer.omniAddress) throw new Error("No omni address");
|
|
321
339
|
|
|
322
340
|
const commitments: Commitment[] = [];
|
|
323
|
-
for (const intent of this.intents) {
|
|
324
|
-
|
|
325
|
-
|
|
341
|
+
for (const intent of this.unsignedCommitment.intents) {
|
|
342
|
+
commitments.push(
|
|
343
|
+
await signer.signIntents([intent], {
|
|
344
|
+
deadline: this.unsignedCommitment.deadline ? +this.unsignedCommitment.deadline : undefined,
|
|
345
|
+
nonce: this.unsignedCommitment.nonce,
|
|
346
|
+
})
|
|
347
|
+
);
|
|
326
348
|
}
|
|
327
349
|
|
|
328
350
|
return commitments;
|
|
@@ -332,37 +354,61 @@ export class Intents {
|
|
|
332
354
|
const signer = this.signer;
|
|
333
355
|
if (!signer) throw new Error("No signer attached");
|
|
334
356
|
if (!signer.omniAddress) throw new Error("No omni address");
|
|
335
|
-
|
|
336
|
-
deadline: this.deadline ? +this.deadline : undefined,
|
|
337
|
-
nonce: this.nonce,
|
|
357
|
+
const commitment = await signer.signIntents(this.unsignedCommitment.intents, {
|
|
358
|
+
deadline: this.unsignedCommitment.deadline ? +this.unsignedCommitment.deadline : undefined,
|
|
359
|
+
nonce: this.unsignedCommitment.nonce,
|
|
338
360
|
});
|
|
361
|
+
|
|
362
|
+
this.unsignedCommitment = { intents: [] };
|
|
363
|
+
this.commitments.push(commitment);
|
|
364
|
+
return this;
|
|
339
365
|
}
|
|
340
366
|
|
|
341
367
|
async simulate() {
|
|
342
|
-
if (
|
|
343
|
-
|
|
344
|
-
return await Intents.simulateIntents([signed]);
|
|
368
|
+
if (this.commitments.length === 0) throw new Error("No commitments attached");
|
|
369
|
+
return await Intents.simulateIntents(this.commitments);
|
|
345
370
|
}
|
|
346
371
|
|
|
347
|
-
async
|
|
372
|
+
async yieldExecute(payload?: Record<string, any>) {
|
|
348
373
|
if (!this.wibe3) throw new Error("No wibe3 attached");
|
|
349
|
-
|
|
374
|
+
const { depositQoute, processing } = await openPayment(this.wibe3, this);
|
|
375
|
+
const depositAddress = depositQoute === "direct" ? undefined : typeof depositQoute?.qoute === "object" ? depositQoute?.qoute?.depositAddress : undefined;
|
|
376
|
+
|
|
377
|
+
if (depositAddress) {
|
|
378
|
+
const { near_trx } = await api.yieldIntentCall({ depositAddress, commitment: this.commitments[0], payload });
|
|
379
|
+
return near_trx;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
await processing?.();
|
|
383
|
+
return this.execute();
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
async depositAndExecute() {
|
|
387
|
+
if (!this.wibe3) throw new Error("No wibe3 attached");
|
|
388
|
+
const { processing } = await openPayment(this.wibe3, this);
|
|
389
|
+
await processing?.();
|
|
390
|
+
return this.execute();
|
|
350
391
|
}
|
|
351
392
|
|
|
352
|
-
async
|
|
353
|
-
|
|
354
|
-
|
|
393
|
+
async execute() {
|
|
394
|
+
const task = Intents.publish(this.commitments, this.signedHashes);
|
|
395
|
+
this.commitments = [];
|
|
396
|
+
this.signedHashes = [];
|
|
397
|
+
|
|
398
|
+
const hash = await task;
|
|
399
|
+
await rpc.waitTransactionResult(hash, "intents.near");
|
|
400
|
+
return hash;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
async executeBatch(params = { checkTokens: true, chunkSize: this.unsignedCommitment.intents.length, onSuccess: (bucket: number, hash: string) => {} }) {
|
|
404
|
+
if (this.commitments.length === 0) throw new Error("No commitments attached");
|
|
405
|
+
const batches = formatter.chunk(this.unsignedCommitment.intents, params.chunkSize);
|
|
355
406
|
let index = 0;
|
|
356
407
|
|
|
357
408
|
const hashes: string[] = [];
|
|
358
409
|
for (const batch of batches) {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
nonce: this.nonce,
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
const hash = await Intents.publish([...this.commitments, signed], this.hashes);
|
|
365
|
-
await rpc.waitTransactionResult(hash, "intents.near");
|
|
410
|
+
this.unsignedCommitment.intents = batch;
|
|
411
|
+
const hash = await this.sign().then(() => this.execute());
|
|
366
412
|
params.onSuccess(index++, hash);
|
|
367
413
|
hashes.push(hash);
|
|
368
414
|
}
|
package/src/core/api.ts
CHANGED
|
@@ -8,6 +8,16 @@ export class ApiError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export interface PaymentStatus {
|
|
12
|
+
payment_id: string;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
amount: string;
|
|
15
|
+
token_id: string;
|
|
16
|
+
sender_id: string;
|
|
17
|
+
near_trx: string;
|
|
18
|
+
status: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
11
21
|
export interface TokenType {
|
|
12
22
|
icon: string;
|
|
13
23
|
symbol: string;
|
|
@@ -69,16 +79,29 @@ export class Api {
|
|
|
69
79
|
return result.balances?.[chain] || [];
|
|
70
80
|
}
|
|
71
81
|
|
|
72
|
-
async
|
|
82
|
+
async yieldIntentCall(args: { commitment: Commitment; depositAddress?: string; payload?: Record<string, any> }) {
|
|
73
83
|
return await this.request(`/api/v1/wibe3/yield_intent_call`, {
|
|
74
|
-
body: JSON.stringify({ commitment, deposit_address: depositAddress }),
|
|
75
84
|
method: "POST",
|
|
85
|
+
body: JSON.stringify({
|
|
86
|
+
commitment: args.commitment,
|
|
87
|
+
deposit_address: args.depositAddress,
|
|
88
|
+
...args.payload,
|
|
89
|
+
}),
|
|
76
90
|
});
|
|
77
91
|
}
|
|
78
92
|
|
|
93
|
+
async paymentStatus(memo: string): Promise<PaymentStatus> {
|
|
94
|
+
const result = await this.request(`/partners/processed_payments?memo=${memo}`, { method: "GET" });
|
|
95
|
+
return result.payments[0];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async getPayments(merchantId: string): Promise<PaymentStatus[]> {
|
|
99
|
+
const result = await this.request(`/partners/processed_payments?merchant_id=${merchantId}`, { method: "GET" });
|
|
100
|
+
return result.payments;
|
|
101
|
+
}
|
|
102
|
+
|
|
79
103
|
async publishIntents(signed: Record<string, any>[], hashes: string[]) {
|
|
80
104
|
const result = await this.request(`/api/v1/wibe3/solver-bus`, {
|
|
81
|
-
headers: { "Content-Type": "application/json" },
|
|
82
105
|
method: "POST",
|
|
83
106
|
body: JSON.stringify({
|
|
84
107
|
params: [{ signed_datas: signed, quote_hashes: hashes }],
|
|
@@ -93,7 +116,6 @@ export class Api {
|
|
|
93
116
|
|
|
94
117
|
async getIntentsStatus(intentHash: string) {
|
|
95
118
|
const result = await this.request(`/api/v1/wibe3/solver-bus`, {
|
|
96
|
-
headers: { "Content-Type": "application/json" },
|
|
97
119
|
method: "POST",
|
|
98
120
|
body: JSON.stringify({
|
|
99
121
|
params: [{ intent_hash: intentHash }],
|
package/src/cosmos/connector.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { hex } from "@scure/base";
|
|
|
6
6
|
|
|
7
7
|
import { api } from "../core/api";
|
|
8
8
|
import { chains, WalletType } from "../core/chains";
|
|
9
|
-
import { ConnectorType, OmniConnector, WC_ICON } from "../OmniConnector";
|
|
9
|
+
import { ConnectorType, OmniConnector, OmniConnectorOption, WC_ICON } from "../OmniConnector";
|
|
10
10
|
import { HotConnector } from "../HotConnector";
|
|
11
11
|
import { OmniWallet } from "../OmniWallet";
|
|
12
12
|
|
|
@@ -20,9 +20,9 @@ declare global {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const wallets = {
|
|
23
|
+
const wallets: Record<string, OmniConnectorOption> = {
|
|
24
24
|
keplr: {
|
|
25
|
-
name: "Keplr",
|
|
25
|
+
name: "Keplr Wallet",
|
|
26
26
|
icon: "https://cdn.prod.website-files.com/667dc891bc7b863b5397495b/68a4ca95f93a9ab64dc67ab4_keplr-symbol.svg",
|
|
27
27
|
download: "https://www.keplr.app/get",
|
|
28
28
|
deeplink: "keplrwallet://wcV2?",
|
|
@@ -30,13 +30,21 @@ const wallets = {
|
|
|
30
30
|
id: "keplr",
|
|
31
31
|
},
|
|
32
32
|
leap: {
|
|
33
|
-
name: "Leap",
|
|
33
|
+
name: "Leap Wallet",
|
|
34
34
|
icon: "https://framerusercontent.com/images/AbGYvbwnLekBbsdf5g7PI5PpSg.png?scale-down-to=512",
|
|
35
35
|
download: "https://www.leapwallet.io/download",
|
|
36
36
|
deeplink: "leapcosmos://wcV2?",
|
|
37
37
|
type: "extension",
|
|
38
38
|
id: "leap",
|
|
39
39
|
},
|
|
40
|
+
gonkaWallet: {
|
|
41
|
+
name: "Gonka Wallet",
|
|
42
|
+
icon: "https://gonka-wallet.startonus.com/images/logo.png",
|
|
43
|
+
download: "https://t.me/gonka_wallet",
|
|
44
|
+
deeplink: "https://gonka-wallet.startonus.com/wc?wc=",
|
|
45
|
+
type: "external",
|
|
46
|
+
id: "gonkaWallet",
|
|
47
|
+
},
|
|
40
48
|
};
|
|
41
49
|
|
|
42
50
|
export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
@@ -50,28 +58,12 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
|
50
58
|
constructor(wibe3: HotConnector) {
|
|
51
59
|
super(wibe3);
|
|
52
60
|
|
|
53
|
-
this.options =
|
|
54
|
-
{
|
|
55
|
-
name: "Keplr",
|
|
56
|
-
download: "https://www.keplr.app/get",
|
|
57
|
-
icon: "https://cdn.prod.website-files.com/667dc891bc7b863b5397495b/68a4ca95f93a9ab64dc67ab4_keplr-symbol.svg",
|
|
58
|
-
type: "keplr" in window ? "extension" : "external",
|
|
59
|
-
id: "keplr",
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: "leap" in window ? "Leap" : "Leap Mobile",
|
|
63
|
-
download: "https://www.leapwallet.io/download",
|
|
64
|
-
icon: "https://framerusercontent.com/images/AbGYvbwnLekBbsdf5g7PI5PpSg.png?scale-down-to=512",
|
|
65
|
-
type: "leap" in window ? "extension" : "external",
|
|
66
|
-
id: "leap",
|
|
67
|
-
},
|
|
68
|
-
];
|
|
69
|
-
|
|
61
|
+
this.options = Object.values(wallets);
|
|
70
62
|
Keplr.getKeplr().then((keplr) => {
|
|
71
63
|
const option = this.options.find((option) => option.id === "keplr")!;
|
|
72
64
|
runInAction(() => {
|
|
73
65
|
option.type = keplr ? "extension" : "external";
|
|
74
|
-
option.name = keplr ? "Keplr" : "Keplr Mobile";
|
|
66
|
+
option.name = keplr ? "Keplr Wallet" : "Keplr Mobile";
|
|
75
67
|
});
|
|
76
68
|
});
|
|
77
69
|
|
|
@@ -113,7 +105,7 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
|
113
105
|
return chains.getByType(WalletType.COSMOS).map((t) => t.key);
|
|
114
106
|
}
|
|
115
107
|
|
|
116
|
-
async setupWalletConnect(id?: "keplr" | "leap"): Promise<CosmosWallet> {
|
|
108
|
+
async setupWalletConnect(id?: "keplr" | "leap" | "gonkaWallet"): Promise<CosmosWallet> {
|
|
117
109
|
const wc = await this.wc;
|
|
118
110
|
if (!wc) throw new Error("WalletConnect not found");
|
|
119
111
|
|
|
@@ -183,7 +175,7 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
|
183
175
|
);
|
|
184
176
|
}
|
|
185
177
|
|
|
186
|
-
async connectKeplr(type: "keplr" | "leap", extension?: Keplr): Promise<OmniWallet | { qrcode: string; deeplink?: string; task: Promise<OmniWallet> }> {
|
|
178
|
+
async connectKeplr(type: "keplr" | "leap" | "gonkaWallet", extension?: Keplr): Promise<OmniWallet | { qrcode: string; deeplink?: string; task: Promise<OmniWallet> }> {
|
|
187
179
|
if (!extension) {
|
|
188
180
|
return await this.connectWalletConnect({
|
|
189
181
|
onConnect: () => this.setupWalletConnect(type),
|
|
@@ -232,6 +224,10 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
|
|
|
232
224
|
});
|
|
233
225
|
}
|
|
234
226
|
|
|
227
|
+
if (id === "gonkaWallet") {
|
|
228
|
+
return await this.connectKeplr("gonkaWallet");
|
|
229
|
+
}
|
|
230
|
+
|
|
235
231
|
if (id === "keplr") {
|
|
236
232
|
const keplr = await Keplr.getKeplr();
|
|
237
233
|
return await this.connectKeplr("keplr", keplr);
|
package/src/cosmos/wallet.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { StargateClient } from "@cosmjs/stargate";
|
|
|
2
2
|
import { OmniWallet } from "../OmniWallet";
|
|
3
3
|
import { chains, WalletType } from "../core/chains";
|
|
4
4
|
import { ReviewFee } from "../core/bridge";
|
|
5
|
-
import CosmosConnector from "./connector";
|
|
6
5
|
import { Commitment } from "../core";
|
|
7
6
|
|
|
8
7
|
interface ProtocolWallet {
|
package/src/exchange.ts
CHANGED
|
@@ -334,14 +334,11 @@ export class Exchange {
|
|
|
334
334
|
|
|
335
335
|
const depositAddress = review.qoute.depositAddress!;
|
|
336
336
|
let hash = "";
|
|
337
|
+
|
|
337
338
|
if (review.from.chain === Network.Hot) {
|
|
338
339
|
hash = await this.wibe3
|
|
339
340
|
.intentsBuilder(sender)
|
|
340
|
-
.transfer({
|
|
341
|
-
amount: review.amountIn,
|
|
342
|
-
token: review.from.address as OmniToken,
|
|
343
|
-
recipient: depositAddress,
|
|
344
|
-
})
|
|
341
|
+
.transfer({ amount: review.amountIn, token: review.from.address as OmniToken, recipient: depositAddress })
|
|
345
342
|
.execute();
|
|
346
343
|
} else {
|
|
347
344
|
hash = await sender.transfer({
|
package/src/solana/wallet.ts
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
} from "@solana/spl-token";
|
|
15
15
|
|
|
16
16
|
import { Network, WalletType } from "../core/chains";
|
|
17
|
-
import { OmniConnector } from "../OmniConnector";
|
|
18
17
|
import { OmniWallet } from "../OmniWallet";
|
|
19
18
|
|
|
20
19
|
import { Token } from "../core/token";
|
|
@@ -148,7 +147,7 @@ class SolanaWallet extends OmniWallet {
|
|
|
148
147
|
}
|
|
149
148
|
|
|
150
149
|
async getPriorityFeeEstimate(params: any): Promise<any> {
|
|
151
|
-
const response = await fetch(api.baseUrl + "/api/v1/
|
|
150
|
+
const response = await fetch(api.baseUrl + "/api/v1/evm/helius/staked", {
|
|
152
151
|
body: JSON.stringify({ jsonrpc: "2.0", id: "helius-sdk", method: "getPriorityFeeEstimate", params: [params] }),
|
|
153
152
|
headers: { "Content-Type": "application/json" },
|
|
154
153
|
method: "POST",
|
package/src/ui/Popup.tsx
CHANGED
|
@@ -22,7 +22,7 @@ interface PopupProps {
|
|
|
22
22
|
widget?: boolean;
|
|
23
23
|
children: React.ReactNode;
|
|
24
24
|
header?: React.ReactNode;
|
|
25
|
-
onClose
|
|
25
|
+
onClose?: () => void;
|
|
26
26
|
style?: React.CSSProperties;
|
|
27
27
|
mobileFullscreen?: boolean;
|
|
28
28
|
}
|
|
@@ -57,9 +57,12 @@ const Popup = ({ widget, children, header, onClose, style, mobileFullscreen }: P
|
|
|
57
57
|
<ModalContent ref={contentRef} $mobileFullscreen={mobileFullscreen} style={{ opacity: 0, transform: "translateY(20px)", transition: "all 0.2s ease-in-out" }}>
|
|
58
58
|
{header && (
|
|
59
59
|
<ModalHeader>
|
|
60
|
-
|
|
61
|
-
<
|
|
62
|
-
|
|
60
|
+
{onClose != null && (
|
|
61
|
+
<button onClick={onClose} style={{ position: "absolute", right: 16, top: 16 }}>
|
|
62
|
+
<CloseIcon />
|
|
63
|
+
</button>
|
|
64
|
+
)}
|
|
65
|
+
|
|
63
66
|
{header}
|
|
64
67
|
</ModalHeader>
|
|
65
68
|
)}
|