@fivenorth/loop-sdk 0.11.2 → 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 +35 -0
- 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 +15 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +111 -6
- 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
|
@@ -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,CAA8B;IACtD,OAAO,CAAC,MAAM,CAA+D;gBAEjE,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAmCtG,iBAAiB,IAAI,OAAO;IAItB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,C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C;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
|
@@ -9,6 +9,21 @@ export declare class UnauthorizedError extends Error {
|
|
|
9
9
|
code?: string;
|
|
10
10
|
constructor(code?: string);
|
|
11
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
|
+
}
|
|
12
27
|
export declare function extractErrorCode(message: any): string | null;
|
|
13
28
|
export declare function isUnauthCode(code: string | null | undefined): code is string;
|
|
14
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;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;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"}
|
|
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
|
@@ -17,6 +17,21 @@ export class UnauthorizedError extends Error {
|
|
|
17
17
|
this.code = code;
|
|
18
18
|
}
|
|
19
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
|
+
}
|
|
20
35
|
const UNAUTH_CODES = new Set(['UNAUTHENTICATED', 'UNAUTHORIZED', 'SESSION_EXPIRED', 'LOGGED_OUT']);
|
|
21
36
|
export function extractErrorCode(message) {
|
|
22
37
|
if (typeof message?.error?.code === 'string' && message.error.code.length > 0) {
|
package/dist/index.d.ts
CHANGED
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,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,MAA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2Cb,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
|
@@ -2091,6 +2091,22 @@ class UnauthorizedError extends Error {
|
|
|
2091
2091
|
this.code = code;
|
|
2092
2092
|
}
|
|
2093
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
|
+
}
|
|
2094
2110
|
var UNAUTH_CODES = new Set(["UNAUTHENTICATED", "UNAUTHORIZED", "SESSION_EXPIRED", "LOGGED_OUT"]);
|
|
2095
2111
|
function extractErrorCode(message) {
|
|
2096
2112
|
if (typeof message?.error?.code === "string" && message.error.code.length > 0) {
|
|
@@ -2565,8 +2581,28 @@ class Connection {
|
|
|
2565
2581
|
}
|
|
2566
2582
|
return response.json();
|
|
2567
2583
|
}
|
|
2568
|
-
|
|
2569
|
-
|
|
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`, {
|
|
2570
2606
|
method: "POST",
|
|
2571
2607
|
headers: {
|
|
2572
2608
|
"Content-Type": "application/json",
|
|
@@ -2576,13 +2612,21 @@ class Connection {
|
|
|
2576
2612
|
payload: params,
|
|
2577
2613
|
ticket_id: session.ticketId
|
|
2578
2614
|
})
|
|
2579
|
-
})
|
|
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();
|
|
2580
2624
|
}
|
|
2581
2625
|
async executeTransaction(session, params) {
|
|
2582
2626
|
if (!session.ticketId) {
|
|
2583
2627
|
throw new Error("Ticket ID is required");
|
|
2584
2628
|
}
|
|
2585
|
-
const
|
|
2629
|
+
const response = await fetch(`${this.apiUrl}/api/v1/.connect/tickets/execute-transaction`, {
|
|
2586
2630
|
method: "POST",
|
|
2587
2631
|
headers: {
|
|
2588
2632
|
"Content-Type": "application/json",
|
|
@@ -2596,7 +2640,62 @@ class Connection {
|
|
|
2596
2640
|
transaction_data: params.transaction_data
|
|
2597
2641
|
})
|
|
2598
2642
|
});
|
|
2599
|
-
|
|
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();
|
|
2600
2699
|
}
|
|
2601
2700
|
websocketUrl(ticketId) {
|
|
2602
2701
|
return `${this.network === "local" ? "ws" : "wss"}://${this.apiUrl.replace("https://", "").replace("http://", "")}/api/v1/.connect/pair/ws/${encodeURIComponent(ticketId)}`;
|
|
@@ -2786,7 +2885,7 @@ class LoopWallet {
|
|
|
2786
2885
|
|
|
2787
2886
|
// src/index.ts
|
|
2788
2887
|
class LoopSDK {
|
|
2789
|
-
version = "0.
|
|
2888
|
+
version = "0.12.0";
|
|
2790
2889
|
appName = "Unknown";
|
|
2791
2890
|
connection = null;
|
|
2792
2891
|
session = null;
|
|
@@ -3241,5 +3340,11 @@ class LoopSDK {
|
|
|
3241
3340
|
var loop = new LoopSDK;
|
|
3242
3341
|
export {
|
|
3243
3342
|
loop,
|
|
3343
|
+
isUnauthCode,
|
|
3344
|
+
extractErrorCode,
|
|
3345
|
+
UnauthorizedError,
|
|
3346
|
+
RequestTimeoutError,
|
|
3347
|
+
RejectRequestError,
|
|
3348
|
+
PaymentRequiredError,
|
|
3244
3349
|
MessageType
|
|
3245
3350
|
};
|
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,OAA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