@pear-protocol/symmio-client 0.2.39 → 0.2.41
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/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +31 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -17
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +14 -13
- package/dist/react/index.d.ts +14 -13
- package/dist/react/index.js +61 -126
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +61 -126
- package/dist/react/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -19711,6 +19711,7 @@ declare namespace admin {
|
|
|
19711
19711
|
export { admin_grantRole as grantRole, admin_prepareGrantRole as prepareGrantRole, admin_prepareRevokeRole as prepareRevokeRole, admin_revokeRole as revokeRole };
|
|
19712
19712
|
}
|
|
19713
19713
|
|
|
19714
|
+
declare function getHedgerBaseUrl(chainId: number): string;
|
|
19714
19715
|
/**
|
|
19715
19716
|
* Creates a SIWE (Sign-In with Ethereum) message for instant trading auth.
|
|
19716
19717
|
* Follows EIP-4361 format. Token is valid for 30 days.
|
|
@@ -19743,13 +19744,14 @@ declare function getOpenInstantCloses(chainId: number, account: Address, accessT
|
|
|
19743
19744
|
|
|
19744
19745
|
declare const instant_cancelInstantClose: typeof cancelInstantClose;
|
|
19745
19746
|
declare const instant_createSiweMessage: typeof createSiweMessage;
|
|
19747
|
+
declare const instant_getHedgerBaseUrl: typeof getHedgerBaseUrl;
|
|
19746
19748
|
declare const instant_getNonce: typeof getNonce;
|
|
19747
19749
|
declare const instant_getOpenInstantCloses: typeof getOpenInstantCloses;
|
|
19748
19750
|
declare const instant_instantClose: typeof instantClose;
|
|
19749
19751
|
declare const instant_instantOpen: typeof instantOpen;
|
|
19750
19752
|
declare const instant_login: typeof login;
|
|
19751
19753
|
declare namespace instant {
|
|
19752
|
-
export { instant_cancelInstantClose as cancelInstantClose, instant_createSiweMessage as createSiweMessage, instant_getNonce as getNonce, instant_getOpenInstantCloses as getOpenInstantCloses, instant_instantClose as instantClose, instant_instantOpen as instantOpen, instant_login as login };
|
|
19754
|
+
export { instant_cancelInstantClose as cancelInstantClose, instant_createSiweMessage as createSiweMessage, instant_getHedgerBaseUrl as getHedgerBaseUrl, instant_getNonce as getNonce, instant_getOpenInstantCloses as getOpenInstantCloses, instant_instantClose as instantClose, instant_instantOpen as instantOpen, instant_login as login };
|
|
19753
19755
|
}
|
|
19754
19756
|
|
|
19755
19757
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -19711,6 +19711,7 @@ declare namespace admin {
|
|
|
19711
19711
|
export { admin_grantRole as grantRole, admin_prepareGrantRole as prepareGrantRole, admin_prepareRevokeRole as prepareRevokeRole, admin_revokeRole as revokeRole };
|
|
19712
19712
|
}
|
|
19713
19713
|
|
|
19714
|
+
declare function getHedgerBaseUrl(chainId: number): string;
|
|
19714
19715
|
/**
|
|
19715
19716
|
* Creates a SIWE (Sign-In with Ethereum) message for instant trading auth.
|
|
19716
19717
|
* Follows EIP-4361 format. Token is valid for 30 days.
|
|
@@ -19743,13 +19744,14 @@ declare function getOpenInstantCloses(chainId: number, account: Address, accessT
|
|
|
19743
19744
|
|
|
19744
19745
|
declare const instant_cancelInstantClose: typeof cancelInstantClose;
|
|
19745
19746
|
declare const instant_createSiweMessage: typeof createSiweMessage;
|
|
19747
|
+
declare const instant_getHedgerBaseUrl: typeof getHedgerBaseUrl;
|
|
19746
19748
|
declare const instant_getNonce: typeof getNonce;
|
|
19747
19749
|
declare const instant_getOpenInstantCloses: typeof getOpenInstantCloses;
|
|
19748
19750
|
declare const instant_instantClose: typeof instantClose;
|
|
19749
19751
|
declare const instant_instantOpen: typeof instantOpen;
|
|
19750
19752
|
declare const instant_login: typeof login;
|
|
19751
19753
|
declare namespace instant {
|
|
19752
|
-
export { instant_cancelInstantClose as cancelInstantClose, instant_createSiweMessage as createSiweMessage, instant_getNonce as getNonce, instant_getOpenInstantCloses as getOpenInstantCloses, instant_instantClose as instantClose, instant_instantOpen as instantOpen, instant_login as login };
|
|
19754
|
+
export { instant_cancelInstantClose as cancelInstantClose, instant_createSiweMessage as createSiweMessage, instant_getHedgerBaseUrl as getHedgerBaseUrl, instant_getNonce as getNonce, instant_getOpenInstantCloses as getOpenInstantCloses, instant_instantClose as instantClose, instant_instantOpen as instantOpen, instant_login as login };
|
|
19753
19755
|
}
|
|
19754
19756
|
|
|
19755
19757
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var viem = require('viem');
|
|
4
|
+
var siwe = require('siwe');
|
|
4
5
|
|
|
5
6
|
var __defProp = Object.defineProperty;
|
|
6
7
|
var __export = (target, all) => {
|
|
@@ -24398,6 +24399,7 @@ var instant_exports = {};
|
|
|
24398
24399
|
__export(instant_exports, {
|
|
24399
24400
|
cancelInstantClose: () => cancelInstantClose,
|
|
24400
24401
|
createSiweMessage: () => createSiweMessage,
|
|
24402
|
+
getHedgerBaseUrl: () => getHedgerBaseUrl,
|
|
24401
24403
|
getNonce: () => getNonce,
|
|
24402
24404
|
getOpenInstantCloses: () => getOpenInstantCloses,
|
|
24403
24405
|
instantClose: () => instantClose,
|
|
@@ -24417,19 +24419,17 @@ function createSiweMessage(params) {
|
|
|
24417
24419
|
const expirationTime = new Date(
|
|
24418
24420
|
Date.now() + 30 * 24 * 60 * 60 * 1e3
|
|
24419
24421
|
).toISOString();
|
|
24420
|
-
const message =
|
|
24421
|
-
|
|
24422
|
-
params.address,
|
|
24423
|
-
|
|
24424
|
-
params.
|
|
24425
|
-
|
|
24426
|
-
|
|
24427
|
-
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
-
|
|
24431
|
-
`Expiration Time: ${expirationTime}`
|
|
24432
|
-
].join("\n");
|
|
24422
|
+
const message = new siwe.SiweMessage({
|
|
24423
|
+
domain: params.domain,
|
|
24424
|
+
address: params.address,
|
|
24425
|
+
statement: params.statement,
|
|
24426
|
+
chainId: params.chainId,
|
|
24427
|
+
nonce: params.nonce,
|
|
24428
|
+
version,
|
|
24429
|
+
uri: params.uri,
|
|
24430
|
+
issuedAt,
|
|
24431
|
+
expirationTime
|
|
24432
|
+
}).prepareMessage();
|
|
24433
24433
|
return { message, issuedAt, expirationTime };
|
|
24434
24434
|
}
|
|
24435
24435
|
async function getNonce(chainId, subAccount) {
|
|
@@ -24458,10 +24458,24 @@ async function login(chainId, params) {
|
|
|
24458
24458
|
body: JSON.stringify(body)
|
|
24459
24459
|
});
|
|
24460
24460
|
if (!response.ok) {
|
|
24461
|
-
|
|
24462
|
-
|
|
24463
|
-
|
|
24464
|
-
|
|
24461
|
+
let errorMessage = "";
|
|
24462
|
+
if (typeof response.text === "function") {
|
|
24463
|
+
const rawBody = await response.text().catch(() => "");
|
|
24464
|
+
if (rawBody) {
|
|
24465
|
+
try {
|
|
24466
|
+
const parsed = JSON.parse(rawBody);
|
|
24467
|
+
errorMessage = parsed.error_message ?? parsed.message ?? parsed.detail ?? rawBody;
|
|
24468
|
+
} catch {
|
|
24469
|
+
errorMessage = rawBody;
|
|
24470
|
+
}
|
|
24471
|
+
}
|
|
24472
|
+
}
|
|
24473
|
+
if (!errorMessage && typeof response.json === "function") {
|
|
24474
|
+
const errorData = await response.json().catch(() => null);
|
|
24475
|
+
errorMessage = errorData?.error_message ?? errorData?.message ?? errorData?.detail ?? "";
|
|
24476
|
+
}
|
|
24477
|
+
const reason = errorMessage || response.statusText;
|
|
24478
|
+
throw new Error(reason ? `Login failed: ${reason}` : "Login failed");
|
|
24465
24479
|
}
|
|
24466
24480
|
const data = await response.json();
|
|
24467
24481
|
if (!data.access_token) {
|