@fivenorth/loop-sdk 0.11.1 → 0.12.0
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 +36 -1
- package/dist/connection.d.ts +11 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +90 -6
- package/dist/errors.d.ts +17 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +19 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +135 -25
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +3 -1
- package/dist/server/index.d.ts +5 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +30 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ loop.connect();
|
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
This will open a modal with a QR code for the user to scan with their Loop wallet.
|
|
83
|
-
If you set `requestSigningMode` to `'popup'` (or `'tab'`), each signing/transaction request will also open the wallet dashboard
|
|
83
|
+
If you set `requestSigningMode` to `'popup'` (or `'tab'`), each signing/transaction request will also open the wallet dashboard. The SDK does not auto-close the popup/tab; wallet UI controls completion/close behavior.
|
|
84
84
|
|
|
85
85
|
### 3. Using the Provider
|
|
86
86
|
|
|
@@ -301,6 +301,41 @@ const result = await loop.executeTransaction(preparedPayload);
|
|
|
301
301
|
console.log('Transfer result:', result);
|
|
302
302
|
```
|
|
303
303
|
|
|
304
|
+
### Handling pending network gas in the server SDK
|
|
305
|
+
|
|
306
|
+
Server SDK transactions use an after-execution network gas model. If a previous transaction created unpaid network gas, the next transaction attempt may fail with `PaymentRequiredError`.
|
|
307
|
+
|
|
308
|
+
Best practice: check for due gas before you submit a transaction, and pay it first if present.
|
|
309
|
+
|
|
310
|
+
```javascript
|
|
311
|
+
const dueGas = await loop.checkDueGas();
|
|
312
|
+
|
|
313
|
+
if (dueGas.pending && dueGas.tracking_id) {
|
|
314
|
+
await loop.payGas(dueGas.tracking_id);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
await loop.executeTransaction(preparedPayload);
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
You should still handle `PaymentRequiredError` as a fallback:
|
|
321
|
+
|
|
322
|
+
```javascript
|
|
323
|
+
import { loop, PaymentRequiredError } from '@fivenorth/loop-sdk/server';
|
|
324
|
+
|
|
325
|
+
try {
|
|
326
|
+
await loop.executeTransaction(preparedPayload);
|
|
327
|
+
} catch (error) {
|
|
328
|
+
if (error instanceof PaymentRequiredError) {
|
|
329
|
+
const dueGas = await loop.checkDueGas(error.trackingId);
|
|
330
|
+
console.log('Pending network gas amount:', dueGas.gas_amount);
|
|
331
|
+
|
|
332
|
+
await loop.payGas(error.trackingId);
|
|
333
|
+
} else {
|
|
334
|
+
throw error;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
304
339
|
Example ideas:
|
|
305
340
|
- List pending transfers
|
|
306
341
|
- Accept a pending transfer
|
package/dist/connection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Network, Account, Holding, TransferRequest, PreparedTransferPayload, ExchangeApiKeyResponse, TransactionPayload, PreparedSubmissionResponse, ExecuteSubmissionResquest } from './types';
|
|
1
|
+
import type { Network, Account, Holding, TransferRequest, PreparedTransferPayload, ExchangeApiKeyResponse, TransactionPayload, PreparedSubmissionResponse, ExecuteSubmissionResquest, PendingGasResponse } from './types';
|
|
2
2
|
import { SessionInfo } from './session';
|
|
3
3
|
export declare class Connection {
|
|
4
4
|
walletUrl: string;
|
|
@@ -32,8 +32,18 @@ export declare class Connection {
|
|
|
32
32
|
signature: string;
|
|
33
33
|
epoch: number;
|
|
34
34
|
}): Promise<ExchangeApiKeyResponse>;
|
|
35
|
+
private parseErrorResponse;
|
|
36
|
+
private errorMessage;
|
|
35
37
|
prepareTransaction(session: SessionInfo, params: TransactionPayload): Promise<PreparedSubmissionResponse>;
|
|
36
38
|
executeTransaction(session: SessionInfo, params: ExecuteSubmissionResquest): Promise<PreparedSubmissionResponse>;
|
|
39
|
+
getPendingGas(userApiKey: string, trackingId?: string): Promise<PendingGasResponse>;
|
|
40
|
+
preparePendingGas(userApiKey: string, trackingId?: string): Promise<{
|
|
41
|
+
transaction_hash: string;
|
|
42
|
+
}>;
|
|
43
|
+
executePendingGas(userApiKey: string, params: {
|
|
44
|
+
transaction_hash: string;
|
|
45
|
+
signature: string;
|
|
46
|
+
}): Promise<any>;
|
|
37
47
|
private websocketUrl;
|
|
38
48
|
private attachWebSocket;
|
|
39
49
|
}
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,eAAe,EACf,uBAAuB,EAEvB,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,eAAe,EACf,uBAAuB,EAEvB,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,EACzB,kBAAkB,EACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,qBAAa,UAAU;IACZ,SAAS,EAAE,MAAM,CAA4B;IAC7C,MAAM,EAAE,MAAM,CAA4B;IAC1C,EAAE,EAAE,SAAS,GAAG,IAAI,CAAQ;IACnC,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,gBAAgB,CAAgD;IACxE,OAAO,CAAC,gBAAgB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EAAE,kBAAkB,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAyBzG,kBAAkB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,0BAA0B,CAAC;IA+BhH,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAqBnF,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,gBAAgB,EAAE,MAAM,CAAA;KAAE,CAAC;IAkBjG,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAmBlH,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,eAAe;CAqC1B"}
|
package/dist/connection.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UnauthorizedError } from './errors';
|
|
1
|
+
import { PaymentRequiredError, UnauthorizedError } from './errors';
|
|
2
2
|
import { generateRequestId } from './provider';
|
|
3
3
|
export class Connection {
|
|
4
4
|
walletUrl = 'https://cantonloop.com';
|
|
@@ -220,9 +220,30 @@ export class Connection {
|
|
|
220
220
|
}
|
|
221
221
|
return response.json();
|
|
222
222
|
}
|
|
223
|
+
async parseErrorResponse(response) {
|
|
224
|
+
const text = await response.text();
|
|
225
|
+
if (!text) {
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
try {
|
|
229
|
+
return JSON.parse(text);
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
return text;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
errorMessage(details, fallback) {
|
|
236
|
+
if (typeof details === 'string' && details.length > 0) {
|
|
237
|
+
return details;
|
|
238
|
+
}
|
|
239
|
+
if (typeof details?.message === 'string' && details.message.length > 0) {
|
|
240
|
+
return details.message;
|
|
241
|
+
}
|
|
242
|
+
return fallback;
|
|
243
|
+
}
|
|
223
244
|
// send transaction to v2/interactive-submisison/prepare endpoint to get the prepared transaction
|
|
224
|
-
prepareTransaction(session, params) {
|
|
225
|
-
|
|
245
|
+
async prepareTransaction(session, params) {
|
|
246
|
+
const response = await fetch(`${this.apiUrl}/api/v1/.connect/tickets/prepare-transaction`, {
|
|
226
247
|
method: 'POST',
|
|
227
248
|
headers: {
|
|
228
249
|
'Content-Type': 'application/json',
|
|
@@ -232,14 +253,22 @@ export class Connection {
|
|
|
232
253
|
payload: params,
|
|
233
254
|
ticket_id: session.ticketId,
|
|
234
255
|
})
|
|
235
|
-
})
|
|
256
|
+
});
|
|
257
|
+
if (response.status === 402) {
|
|
258
|
+
throw new PaymentRequiredError(await this.parseErrorResponse(response));
|
|
259
|
+
}
|
|
260
|
+
if (!response.ok) {
|
|
261
|
+
const details = await this.parseErrorResponse(response);
|
|
262
|
+
throw new Error(this.errorMessage(details, `Failed to prepare transaction with status ${response.status}.`));
|
|
263
|
+
}
|
|
264
|
+
return response.json();
|
|
236
265
|
}
|
|
237
266
|
// execute a signed transaction with v2/interactive-submisison/execute endpoint
|
|
238
267
|
async executeTransaction(session, params) {
|
|
239
268
|
if (!session.ticketId) {
|
|
240
269
|
throw new Error('Ticket ID is required');
|
|
241
270
|
}
|
|
242
|
-
const
|
|
271
|
+
const response = await fetch(`${this.apiUrl}/api/v1/.connect/tickets/execute-transaction`, {
|
|
243
272
|
method: 'POST',
|
|
244
273
|
headers: {
|
|
245
274
|
'Content-Type': 'application/json',
|
|
@@ -253,7 +282,62 @@ export class Connection {
|
|
|
253
282
|
transaction_data: params.transaction_data,
|
|
254
283
|
}),
|
|
255
284
|
});
|
|
256
|
-
|
|
285
|
+
if (response.status === 402) {
|
|
286
|
+
throw new PaymentRequiredError(await this.parseErrorResponse(response));
|
|
287
|
+
}
|
|
288
|
+
if (!response.ok) {
|
|
289
|
+
const details = await this.parseErrorResponse(response);
|
|
290
|
+
throw new Error(this.errorMessage(details, `Failed to execute transaction with status ${response.status}.`));
|
|
291
|
+
}
|
|
292
|
+
return response.json();
|
|
293
|
+
}
|
|
294
|
+
async getPendingGas(userApiKey, trackingId) {
|
|
295
|
+
const url = new URL(`${this.apiUrl}/api/v1/transfer/pending-fee`);
|
|
296
|
+
if (trackingId) {
|
|
297
|
+
url.searchParams.set('tracking_id', trackingId);
|
|
298
|
+
}
|
|
299
|
+
const response = await fetch(url.toString(), {
|
|
300
|
+
method: 'GET',
|
|
301
|
+
headers: {
|
|
302
|
+
'Content-Type': 'application/json',
|
|
303
|
+
'Authorization': `Bearer ${userApiKey}`,
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
if (!response.ok) {
|
|
307
|
+
const details = await this.parseErrorResponse(response);
|
|
308
|
+
throw new Error(this.errorMessage(details, 'Failed to get pending gas.'));
|
|
309
|
+
}
|
|
310
|
+
return await response.json();
|
|
311
|
+
}
|
|
312
|
+
async preparePendingGas(userApiKey, trackingId) {
|
|
313
|
+
const response = await fetch(`${this.apiUrl}/api/v1/transfer/pending-fee/prepare`, {
|
|
314
|
+
method: 'POST',
|
|
315
|
+
headers: {
|
|
316
|
+
'Content-Type': 'application/json',
|
|
317
|
+
'Authorization': `Bearer ${userApiKey}`,
|
|
318
|
+
},
|
|
319
|
+
body: JSON.stringify(trackingId ? { tracking_id: trackingId } : {}),
|
|
320
|
+
});
|
|
321
|
+
if (!response.ok) {
|
|
322
|
+
const details = await this.parseErrorResponse(response);
|
|
323
|
+
throw new Error(this.errorMessage(details, 'Failed to prepare pending gas.'));
|
|
324
|
+
}
|
|
325
|
+
return response.json();
|
|
326
|
+
}
|
|
327
|
+
async executePendingGas(userApiKey, params) {
|
|
328
|
+
const response = await fetch(`${this.apiUrl}/api/v1/transfer/pending-fee/execute`, {
|
|
329
|
+
method: 'POST',
|
|
330
|
+
headers: {
|
|
331
|
+
'Content-Type': 'application/json',
|
|
332
|
+
'Authorization': `Bearer ${userApiKey}`,
|
|
333
|
+
},
|
|
334
|
+
body: JSON.stringify(params),
|
|
335
|
+
});
|
|
336
|
+
if (!response.ok) {
|
|
337
|
+
const details = await this.parseErrorResponse(response);
|
|
338
|
+
throw new Error(this.errorMessage(details, 'Failed to execute pending gas.'));
|
|
339
|
+
}
|
|
340
|
+
return response.json();
|
|
257
341
|
}
|
|
258
342
|
websocketUrl(ticketId) {
|
|
259
343
|
return `${this.network === 'local' ? 'ws' : 'wss'}://${this.apiUrl.replace('https://', '').replace('http://', '')}/api/v1/.connect/pair/ws/${encodeURIComponent(ticketId)}`;
|
package/dist/errors.d.ts
CHANGED
|
@@ -2,12 +2,28 @@ export declare class RequestTimeoutError extends Error {
|
|
|
2
2
|
constructor(timeout: number);
|
|
3
3
|
}
|
|
4
4
|
export declare class RejectRequestError extends Error {
|
|
5
|
-
|
|
5
|
+
code?: string;
|
|
6
|
+
constructor(message?: string, code?: string);
|
|
6
7
|
}
|
|
7
8
|
export declare class UnauthorizedError extends Error {
|
|
8
9
|
code?: string;
|
|
9
10
|
constructor(code?: string);
|
|
10
11
|
}
|
|
12
|
+
export declare class PaymentRequiredError extends Error {
|
|
13
|
+
code?: string;
|
|
14
|
+
trackingId?: string;
|
|
15
|
+
gasAmount?: string;
|
|
16
|
+
status?: string;
|
|
17
|
+
expiresAt?: string;
|
|
18
|
+
constructor(details?: {
|
|
19
|
+
message?: string;
|
|
20
|
+
code?: string;
|
|
21
|
+
tracking_id?: string;
|
|
22
|
+
gas_amount?: string;
|
|
23
|
+
status?: string;
|
|
24
|
+
expires_at?: string;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
11
27
|
export declare function extractErrorCode(message: any): string | null;
|
|
12
28
|
export declare function isUnauthCode(code: string | null | undefined): code is string;
|
|
13
29
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAG9B;AAED,qBAAa,kBAAmB,SAAQ,KAAK
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAG9B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;gBACT,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAI9C;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;gBACT,IAAI,CAAC,EAAE,MAAM;CAI5B;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEd,OAAO,CAAC,EAAE;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;KACvB;CAQJ;AAID,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,CAQ5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,MAAM,CAK5E"}
|
package/dist/errors.js
CHANGED
|
@@ -4,8 +4,10 @@ export class RequestTimeoutError extends Error {
|
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
export class RejectRequestError extends Error {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
code;
|
|
8
|
+
constructor(message, code) {
|
|
9
|
+
super(message || 'Request was rejected by the wallet.');
|
|
10
|
+
this.code = code;
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
export class UnauthorizedError extends Error {
|
|
@@ -15,6 +17,21 @@ export class UnauthorizedError extends Error {
|
|
|
15
17
|
this.code = code;
|
|
16
18
|
}
|
|
17
19
|
}
|
|
20
|
+
export class PaymentRequiredError extends Error {
|
|
21
|
+
code;
|
|
22
|
+
trackingId;
|
|
23
|
+
gasAmount;
|
|
24
|
+
status;
|
|
25
|
+
expiresAt;
|
|
26
|
+
constructor(details) {
|
|
27
|
+
super(details?.message || 'Payment required');
|
|
28
|
+
this.code = details?.code;
|
|
29
|
+
this.trackingId = details?.tracking_id;
|
|
30
|
+
this.gasAmount = details?.gas_amount;
|
|
31
|
+
this.status = details?.status;
|
|
32
|
+
this.expiresAt = details?.expires_at;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
18
35
|
const UNAUTH_CODES = new Set(['UNAUTHENTICATED', 'UNAUTHORIZED', 'SESSION_EXPIRED', 'LOGGED_OUT']);
|
|
19
36
|
export function extractErrorCode(message) {
|
|
20
37
|
if (typeof message?.error?.code === 'string' && message.error.code.length > 0) {
|
package/dist/index.d.ts
CHANGED
|
@@ -38,7 +38,6 @@ declare class LoopSDK {
|
|
|
38
38
|
private buildConnectUrl;
|
|
39
39
|
private buildDashboardUrl;
|
|
40
40
|
private openRequestUi;
|
|
41
|
-
private closePopupIfExists;
|
|
42
41
|
private openWallet;
|
|
43
42
|
private injectModalStyles;
|
|
44
43
|
private showQrCode;
|
|
@@ -49,5 +48,6 @@ declare class LoopSDK {
|
|
|
49
48
|
}
|
|
50
49
|
export declare const loop: LoopSDK;
|
|
51
50
|
export * from "./extensions/usdc/types";
|
|
51
|
+
export * from "./errors";
|
|
52
52
|
export * from "./types";
|
|
53
53
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,KAAK,EAGX,OAAO,EAEP,MAAM,EACN,sBAAsB,EACtB,MAAM,SAAS,CAAC;AAIjB,cAAM,OAAO;IACZ,OAAO,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,KAAK,EAGX,OAAO,EAEP,MAAM,EACN,sBAAsB,EACtB,MAAM,SAAS,CAAC;AAIjB,cAAM,OAAO;IACZ,OAAO,CAAC,OAAO,CAAoB;IAEnC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,kBAAkB,CAA4B;IACtD,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,WAAW,CAAC,CAAS;IAE7B,OAAO,CAAC,QAAQ,CAA+C;IAC/D,OAAO,CAAC,QAAQ,CAA6B;IAC3C,OAAO,CAAC,mBAAmB,CAA0E;IACvG,OAAO,CAAC,OAAO,CAA+B;IACvC,MAAM,EAAE,MAAM,CAAC;;IAMtB,IAAI,CAAC,EACJ,OAAO,EACP,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,OAAO,GACP,EAAE;QACF,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;QACxC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;QACtB,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,sBAAsB,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;QAC9E,OAAO,CAAC,EAAE;YACT,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;YAC3B,kBAAkB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;YACrC,WAAW,CAAC,EAAE,MAAM,CAAC;SACrB,CAAC;KACF;YAiCa,eAAe;IA6CvB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B5B,OAAO;IA2Cb,OAAO,CAAC,sBAAsB;IA8DvB,aAAa,IAAI,MAAM;IAO9B,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,aAAa;IAqBrB,OAAO,CAAC,UAAU;IAuClB,OAAO,CAAC,iBAAiB;IAyIzB,OAAO,CAAC,UAAU;IAoFlB,OAAO,CAAC,UAAU;IAOlB,MAAM;IAQN,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,mBAAmB;CAO3B;AAED,eAAO,MAAM,IAAI,SAAgB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,15 +3,29 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
function __accessProp(key) {
|
|
7
|
+
return this[key];
|
|
8
|
+
}
|
|
9
|
+
var __toESMCache_node;
|
|
10
|
+
var __toESMCache_esm;
|
|
6
11
|
var __toESM = (mod, isNodeMode, target) => {
|
|
12
|
+
var canCache = mod != null && typeof mod === "object";
|
|
13
|
+
if (canCache) {
|
|
14
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
15
|
+
var cached = cache.get(mod);
|
|
16
|
+
if (cached)
|
|
17
|
+
return cached;
|
|
18
|
+
}
|
|
7
19
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
8
20
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
9
21
|
for (let key of __getOwnPropNames(mod))
|
|
10
22
|
if (!__hasOwnProp.call(to, key))
|
|
11
23
|
__defProp(to, key, {
|
|
12
|
-
get: (
|
|
24
|
+
get: __accessProp.bind(mod, key),
|
|
13
25
|
enumerable: true
|
|
14
26
|
});
|
|
27
|
+
if (canCache)
|
|
28
|
+
cache.set(mod, to);
|
|
15
29
|
return to;
|
|
16
30
|
};
|
|
17
31
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
@@ -2063,8 +2077,10 @@ class RequestTimeoutError extends Error {
|
|
|
2063
2077
|
}
|
|
2064
2078
|
|
|
2065
2079
|
class RejectRequestError extends Error {
|
|
2066
|
-
|
|
2067
|
-
|
|
2080
|
+
code;
|
|
2081
|
+
constructor(message, code) {
|
|
2082
|
+
super(message || "Request was rejected by the wallet.");
|
|
2083
|
+
this.code = code;
|
|
2068
2084
|
}
|
|
2069
2085
|
}
|
|
2070
2086
|
|
|
@@ -2075,6 +2091,22 @@ class UnauthorizedError extends Error {
|
|
|
2075
2091
|
this.code = code;
|
|
2076
2092
|
}
|
|
2077
2093
|
}
|
|
2094
|
+
|
|
2095
|
+
class PaymentRequiredError extends Error {
|
|
2096
|
+
code;
|
|
2097
|
+
trackingId;
|
|
2098
|
+
gasAmount;
|
|
2099
|
+
status;
|
|
2100
|
+
expiresAt;
|
|
2101
|
+
constructor(details) {
|
|
2102
|
+
super(details?.message || "Payment required");
|
|
2103
|
+
this.code = details?.code;
|
|
2104
|
+
this.trackingId = details?.tracking_id;
|
|
2105
|
+
this.gasAmount = details?.gas_amount;
|
|
2106
|
+
this.status = details?.status;
|
|
2107
|
+
this.expiresAt = details?.expires_at;
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2078
2110
|
var UNAUTH_CODES = new Set(["UNAUTHENTICATED", "UNAUTHORIZED", "SESSION_EXPIRED", "LOGGED_OUT"]);
|
|
2079
2111
|
function extractErrorCode(message) {
|
|
2080
2112
|
if (typeof message?.error?.code === "string" && message.error.code.length > 0) {
|
|
@@ -2298,13 +2330,15 @@ class Provider {
|
|
|
2298
2330
|
return;
|
|
2299
2331
|
}
|
|
2300
2332
|
if (response.type === "reject_request" /* REJECT_REQUEST */) {
|
|
2333
|
+
const rejectMessage = response?.payload?.message;
|
|
2334
|
+
const rejectCode = response?.payload?.code;
|
|
2301
2335
|
this.hooks?.onRequestFinish?.({
|
|
2302
2336
|
status: "rejected",
|
|
2303
2337
|
messageType,
|
|
2304
2338
|
requestLabel: options?.requestLabel,
|
|
2305
2339
|
requestContext
|
|
2306
2340
|
});
|
|
2307
|
-
reject(new RejectRequestError);
|
|
2341
|
+
reject(new RejectRequestError(rejectMessage, rejectCode));
|
|
2308
2342
|
} else {
|
|
2309
2343
|
this.hooks?.onRequestFinish?.({
|
|
2310
2344
|
status: "success",
|
|
@@ -2547,8 +2581,28 @@ class Connection {
|
|
|
2547
2581
|
}
|
|
2548
2582
|
return response.json();
|
|
2549
2583
|
}
|
|
2550
|
-
|
|
2551
|
-
|
|
2584
|
+
async parseErrorResponse(response) {
|
|
2585
|
+
const text = await response.text();
|
|
2586
|
+
if (!text) {
|
|
2587
|
+
return null;
|
|
2588
|
+
}
|
|
2589
|
+
try {
|
|
2590
|
+
return JSON.parse(text);
|
|
2591
|
+
} catch {
|
|
2592
|
+
return text;
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
errorMessage(details, fallback) {
|
|
2596
|
+
if (typeof details === "string" && details.length > 0) {
|
|
2597
|
+
return details;
|
|
2598
|
+
}
|
|
2599
|
+
if (typeof details?.message === "string" && details.message.length > 0) {
|
|
2600
|
+
return details.message;
|
|
2601
|
+
}
|
|
2602
|
+
return fallback;
|
|
2603
|
+
}
|
|
2604
|
+
async prepareTransaction(session, params) {
|
|
2605
|
+
const response = await fetch(`${this.apiUrl}/api/v1/.connect/tickets/prepare-transaction`, {
|
|
2552
2606
|
method: "POST",
|
|
2553
2607
|
headers: {
|
|
2554
2608
|
"Content-Type": "application/json",
|
|
@@ -2558,13 +2612,21 @@ class Connection {
|
|
|
2558
2612
|
payload: params,
|
|
2559
2613
|
ticket_id: session.ticketId
|
|
2560
2614
|
})
|
|
2561
|
-
})
|
|
2615
|
+
});
|
|
2616
|
+
if (response.status === 402) {
|
|
2617
|
+
throw new PaymentRequiredError(await this.parseErrorResponse(response));
|
|
2618
|
+
}
|
|
2619
|
+
if (!response.ok) {
|
|
2620
|
+
const details = await this.parseErrorResponse(response);
|
|
2621
|
+
throw new Error(this.errorMessage(details, `Failed to prepare transaction with status ${response.status}.`));
|
|
2622
|
+
}
|
|
2623
|
+
return response.json();
|
|
2562
2624
|
}
|
|
2563
2625
|
async executeTransaction(session, params) {
|
|
2564
2626
|
if (!session.ticketId) {
|
|
2565
2627
|
throw new Error("Ticket ID is required");
|
|
2566
2628
|
}
|
|
2567
|
-
const
|
|
2629
|
+
const response = await fetch(`${this.apiUrl}/api/v1/.connect/tickets/execute-transaction`, {
|
|
2568
2630
|
method: "POST",
|
|
2569
2631
|
headers: {
|
|
2570
2632
|
"Content-Type": "application/json",
|
|
@@ -2578,7 +2640,62 @@ class Connection {
|
|
|
2578
2640
|
transaction_data: params.transaction_data
|
|
2579
2641
|
})
|
|
2580
2642
|
});
|
|
2581
|
-
|
|
2643
|
+
if (response.status === 402) {
|
|
2644
|
+
throw new PaymentRequiredError(await this.parseErrorResponse(response));
|
|
2645
|
+
}
|
|
2646
|
+
if (!response.ok) {
|
|
2647
|
+
const details = await this.parseErrorResponse(response);
|
|
2648
|
+
throw new Error(this.errorMessage(details, `Failed to execute transaction with status ${response.status}.`));
|
|
2649
|
+
}
|
|
2650
|
+
return response.json();
|
|
2651
|
+
}
|
|
2652
|
+
async getPendingGas(userApiKey, trackingId) {
|
|
2653
|
+
const url = new URL(`${this.apiUrl}/api/v1/transfer/pending-fee`);
|
|
2654
|
+
if (trackingId) {
|
|
2655
|
+
url.searchParams.set("tracking_id", trackingId);
|
|
2656
|
+
}
|
|
2657
|
+
const response = await fetch(url.toString(), {
|
|
2658
|
+
method: "GET",
|
|
2659
|
+
headers: {
|
|
2660
|
+
"Content-Type": "application/json",
|
|
2661
|
+
Authorization: `Bearer ${userApiKey}`
|
|
2662
|
+
}
|
|
2663
|
+
});
|
|
2664
|
+
if (!response.ok) {
|
|
2665
|
+
const details = await this.parseErrorResponse(response);
|
|
2666
|
+
throw new Error(this.errorMessage(details, "Failed to get pending gas."));
|
|
2667
|
+
}
|
|
2668
|
+
return await response.json();
|
|
2669
|
+
}
|
|
2670
|
+
async preparePendingGas(userApiKey, trackingId) {
|
|
2671
|
+
const response = await fetch(`${this.apiUrl}/api/v1/transfer/pending-fee/prepare`, {
|
|
2672
|
+
method: "POST",
|
|
2673
|
+
headers: {
|
|
2674
|
+
"Content-Type": "application/json",
|
|
2675
|
+
Authorization: `Bearer ${userApiKey}`
|
|
2676
|
+
},
|
|
2677
|
+
body: JSON.stringify(trackingId ? { tracking_id: trackingId } : {})
|
|
2678
|
+
});
|
|
2679
|
+
if (!response.ok) {
|
|
2680
|
+
const details = await this.parseErrorResponse(response);
|
|
2681
|
+
throw new Error(this.errorMessage(details, "Failed to prepare pending gas."));
|
|
2682
|
+
}
|
|
2683
|
+
return response.json();
|
|
2684
|
+
}
|
|
2685
|
+
async executePendingGas(userApiKey, params) {
|
|
2686
|
+
const response = await fetch(`${this.apiUrl}/api/v1/transfer/pending-fee/execute`, {
|
|
2687
|
+
method: "POST",
|
|
2688
|
+
headers: {
|
|
2689
|
+
"Content-Type": "application/json",
|
|
2690
|
+
Authorization: `Bearer ${userApiKey}`
|
|
2691
|
+
},
|
|
2692
|
+
body: JSON.stringify(params)
|
|
2693
|
+
});
|
|
2694
|
+
if (!response.ok) {
|
|
2695
|
+
const details = await this.parseErrorResponse(response);
|
|
2696
|
+
throw new Error(this.errorMessage(details, "Failed to execute pending gas."));
|
|
2697
|
+
}
|
|
2698
|
+
return response.json();
|
|
2582
2699
|
}
|
|
2583
2700
|
websocketUrl(ticketId) {
|
|
2584
2701
|
return `${this.network === "local" ? "ws" : "wss"}://${this.apiUrl.replace("https://", "").replace("http://", "")}/api/v1/.connect/pair/ws/${encodeURIComponent(ticketId)}`;
|
|
@@ -2768,7 +2885,7 @@ class LoopWallet {
|
|
|
2768
2885
|
|
|
2769
2886
|
// src/index.ts
|
|
2770
2887
|
class LoopSDK {
|
|
2771
|
-
version = "0.
|
|
2888
|
+
version = "0.12.0";
|
|
2772
2889
|
appName = "Unknown";
|
|
2773
2890
|
connection = null;
|
|
2774
2891
|
session = null;
|
|
@@ -2973,14 +3090,6 @@ class LoopSDK {
|
|
|
2973
3090
|
}
|
|
2974
3091
|
return null;
|
|
2975
3092
|
}
|
|
2976
|
-
closePopupIfExists() {
|
|
2977
|
-
if (this.popupWindow && !this.popupWindow.closed) {
|
|
2978
|
-
try {
|
|
2979
|
-
this.popupWindow.close();
|
|
2980
|
-
} catch {}
|
|
2981
|
-
}
|
|
2982
|
-
this.popupWindow = null;
|
|
2983
|
-
}
|
|
2984
3093
|
openWallet(url, mode) {
|
|
2985
3094
|
if (typeof window === "undefined") {
|
|
2986
3095
|
return null;
|
|
@@ -3221,13 +3330,8 @@ class LoopSDK {
|
|
|
3221
3330
|
createProviderHooks() {
|
|
3222
3331
|
return {
|
|
3223
3332
|
onRequestStart: () => this.openRequestUi(),
|
|
3224
|
-
onRequestFinish: (
|
|
3225
|
-
|
|
3226
|
-
if (win) {
|
|
3227
|
-
setTimeout(() => {
|
|
3228
|
-
this.closePopupIfExists();
|
|
3229
|
-
}, 800);
|
|
3230
|
-
}
|
|
3333
|
+
onRequestFinish: () => {
|
|
3334
|
+
return;
|
|
3231
3335
|
},
|
|
3232
3336
|
onTransactionUpdate: this.onTransactionUpdate ?? undefined
|
|
3233
3337
|
};
|
|
@@ -3236,5 +3340,11 @@ class LoopSDK {
|
|
|
3236
3340
|
var loop = new LoopSDK;
|
|
3237
3341
|
export {
|
|
3238
3342
|
loop,
|
|
3343
|
+
isUnauthCode,
|
|
3344
|
+
extractErrorCode,
|
|
3345
|
+
UnauthorizedError,
|
|
3346
|
+
RequestTimeoutError,
|
|
3347
|
+
RejectRequestError,
|
|
3348
|
+
PaymentRequiredError,
|
|
3239
3349
|
MessageType
|
|
3240
3350
|
};
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EAGd,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAGpD,eAAO,MAAM,0BAA0B,SAAS,CAAC;AACjD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;AAC/E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,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AAE,UAAU,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,aAAa,CAAA;KAAE;IAYhM,YAAY,IAAI,MAAM;IAKtB,cAAc,CAAC,OAAO,EAAE,GAAG;IAmBlC,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAMhC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAI9B,kBAAkB,CAAC,MAAM,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAK/F,iBAAiB,CACrB,OAAO,EAAE,kBAAkB,EAC3B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,GAAG,CAAC;IAST,2BAA2B,CAC/B,OAAO,EAAE,kBAAkB,EAC3B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,GAAG,CAAC;IAST,QAAQ,CACZ,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,UAAU,CAAC,EAAE,cAAc,EAC3B,OAAO,CAAC,EAAE,eAAe,GAAG;QAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,GAC/D,OAAO,CAAC,GAAG,CAAC;IAmDT,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;YAIlC,eAAe;IAa7B,OAAO,CAAC,WAAW;CA+GtB"}
|
package/dist/provider.js
CHANGED
|
@@ -207,13 +207,15 @@ export class Provider {
|
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
209
|
if (response.type === MessageType.REJECT_REQUEST) {
|
|
210
|
+
const rejectMessage = response?.payload?.message;
|
|
211
|
+
const rejectCode = response?.payload?.code;
|
|
210
212
|
this.hooks?.onRequestFinish?.({
|
|
211
213
|
status: 'rejected',
|
|
212
214
|
messageType,
|
|
213
215
|
requestLabel: options?.requestLabel,
|
|
214
216
|
requestContext,
|
|
215
217
|
});
|
|
216
|
-
reject(new RejectRequestError());
|
|
218
|
+
reject(new RejectRequestError(rejectMessage, rejectCode));
|
|
217
219
|
}
|
|
218
220
|
else {
|
|
219
221
|
this.hooks?.onRequestFinish?.({
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Provider } from '../provider';
|
|
2
|
-
import type { Network, TransactionPayload } from '../types';
|
|
2
|
+
import type { Network, TransactionPayload, PendingGasResponse } from '../types';
|
|
3
3
|
import { Signer } from './signer';
|
|
4
4
|
export declare class LoopSDK {
|
|
5
5
|
private signer?;
|
|
@@ -18,6 +18,10 @@ export declare class LoopSDK {
|
|
|
18
18
|
getSigner(): Signer;
|
|
19
19
|
getProvider(): Provider;
|
|
20
20
|
executeTransaction(payload: TransactionPayload): Promise<any>;
|
|
21
|
+
checkDueGas(trackingId?: string): Promise<PendingGasResponse>;
|
|
22
|
+
payGas(trackingId: string): Promise<any>;
|
|
21
23
|
}
|
|
22
24
|
export declare const loop: LoopSDK;
|
|
25
|
+
export * from '../errors';
|
|
26
|
+
export * from '../types';
|
|
23
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,aAAa,CAAC;AAG3D,OAAO,KAAK,EAAE,OAAO,EAAyE,kBAAkB,EAAyD,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,aAAa,CAAC;AAG3D,OAAO,KAAK,EAAE,OAAO,EAAyE,kBAAkB,EAAyD,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9M,OAAO,EAAa,MAAM,EAAE,MAAM,UAAU,CAAC;AA8C7C,qBAAa,OAAO;IAChB,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,CAAc;IAC/B,OAAO,CAAC,UAAU,CAAC,CAAa;IAChC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,OAAO,CAAC,CAAc;IAE9B,IAAI,CAAC,EAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC;IASzI,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAoCnC,SAAS,IAAI,MAAM;IAOnB,WAAW,IAAI,QAAQ;IAOjB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC;IAwB7D,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAQ7D,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CA0BxD;AAED,eAAO,MAAM,IAAI,SAAgB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
package/dist/server/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import { Provider } from '../provider';
|
|
|
2
2
|
import { Connection } from '../connection';
|
|
3
3
|
import { SessionInfo } from '../session';
|
|
4
4
|
import { getSigner } from './signer';
|
|
5
|
+
const PAY_GAS_WAIT_MS = 10_000;
|
|
6
|
+
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
5
7
|
class RpcProvider extends Provider {
|
|
6
8
|
ticket_id;
|
|
7
9
|
user_api_key;
|
|
@@ -113,5 +115,33 @@ export class LoopSDK {
|
|
|
113
115
|
});
|
|
114
116
|
return submissionResponse;
|
|
115
117
|
}
|
|
118
|
+
async checkDueGas(trackingId) {
|
|
119
|
+
if (!this.connection || !this.session) {
|
|
120
|
+
throw new Error('Provider and session are required');
|
|
121
|
+
}
|
|
122
|
+
return await this.connection.getPendingGas(this.session.userApiKey, trackingId);
|
|
123
|
+
}
|
|
124
|
+
async payGas(trackingId) {
|
|
125
|
+
if (!this.provider || !this.signer || !this.connection || !this.session) {
|
|
126
|
+
throw new Error('Provider and signer are required');
|
|
127
|
+
}
|
|
128
|
+
const pendingGas = await this.checkDueGas(trackingId);
|
|
129
|
+
if (!pendingGas.pending) {
|
|
130
|
+
throw new Error(`Pending gas not found for tracking_id ${trackingId}.`);
|
|
131
|
+
}
|
|
132
|
+
const preparedGas = await this.connection.preparePendingGas(this.session.userApiKey, trackingId);
|
|
133
|
+
if (!preparedGas?.transaction_hash) {
|
|
134
|
+
throw new Error('Failed to prepare pending gas.');
|
|
135
|
+
}
|
|
136
|
+
const signedTransactionHash = this.getSigner().signTransactionHash(preparedGas.transaction_hash);
|
|
137
|
+
const result = await this.connection.executePendingGas(this.session.userApiKey, {
|
|
138
|
+
transaction_hash: preparedGas.transaction_hash,
|
|
139
|
+
signature: signedTransactionHash,
|
|
140
|
+
});
|
|
141
|
+
await wait(PAY_GAS_WAIT_MS);
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
116
144
|
}
|
|
117
145
|
export const loop = new LoopSDK();
|
|
146
|
+
export * from '../errors';
|
|
147
|
+
export * from '../types';
|
package/dist/types.d.ts
CHANGED
|
@@ -113,4 +113,13 @@ export type ExecuteSubmissionResquest = {
|
|
|
113
113
|
transaction_data: string;
|
|
114
114
|
signature: string;
|
|
115
115
|
};
|
|
116
|
+
export type PendingGasResponse = {
|
|
117
|
+
pending: boolean;
|
|
118
|
+
tracking_id?: string;
|
|
119
|
+
gas_amount?: string;
|
|
120
|
+
status?: string;
|
|
121
|
+
origin?: string;
|
|
122
|
+
expires_at?: string;
|
|
123
|
+
request_id?: string;
|
|
124
|
+
};
|
|
116
125
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3F,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,SAAS,GAAG,SAAS,CAAC;AAC3E,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;CAC3C,CAAC;AAEF,oBAAY,WAAW;IACrB,gBAAgB,qBAAqB;IACrC,gBAAgB,qBAAqB;IAErC,eAAe,oBAAoB;IACnC,qBAAqB,0BAA0B;IAE/C,gBAAgB,qBAAqB;IACrC,yBAAyB,8BAA8B;IACvD,cAAc,mBAAmB;CAClC;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,aAAa,EAAE,YAAY,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;I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