@silentswap/sdk 0.0.9 → 0.0.11

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/client.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ENVIRONMENT, MAINNET_GATEWAY_ADDRESS, MAINNET_GATEWAY_PUBLIC_KEY, MAINNET_SILENTSWAP_API } from './constants.js';
2
+ const FETCH_TIMEOUT = 10_000;
2
3
  const ENVIRONMENT_CONFIGS = {
3
4
  [ENVIRONMENT.MAINNET]: {
4
5
  gatewayAddress: MAINNET_GATEWAY_ADDRESS,
@@ -28,6 +29,7 @@ class SilentSwapClient {
28
29
  const { config } = this;
29
30
  // submit GET request
30
31
  const res = await fetch(`${(config.baseUrl ?? MAINNET_SILENTSWAP_API) + path}?${new URLSearchParams(params).toString()}`, {
32
+ signal: AbortSignal.timeout(FETCH_TIMEOUT),
31
33
  ...init || {},
32
34
  method: 'GET',
33
35
  headers: {
@@ -72,6 +74,7 @@ class SilentSwapClient {
72
74
  const { config } = this;
73
75
  // submit POST request
74
76
  const res = await fetch((config.baseUrl ?? MAINNET_SILENTSWAP_API) + path, {
77
+ signal: AbortSignal.timeout(FETCH_TIMEOUT),
75
78
  ...init || {},
76
79
  method: 'POST',
77
80
  headers: {
package/dist/sdk.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { Hex } from 'viem';
7
7
  * @param nonce - nonce from the server (base58)
8
8
  * @returns SIWE message
9
9
  */
10
- export declare function createSignInMessage(user: Hex, nonce: string): SignInMessage;
10
+ export declare function createSignInMessage(user: Hex, nonce: string, subdomain?: string): SignInMessage;
11
11
  /**
12
12
  * Creates an EIP-712 document for a SilentSwap order
13
13
  * @param quote - quote response
package/dist/sdk.js CHANGED
@@ -6,13 +6,13 @@ import { EIP712_DOMAIN_ORDER_DEFAULT, EIP712_TYPES_ORDER, EIP712_TYPES_WALLET_GE
6
6
  * @param nonce - nonce from the server (base58)
7
7
  * @returns SIWE message
8
8
  */
9
- export function createSignInMessage(user, nonce) {
9
+ export function createSignInMessage(user, nonce, subdomain = 'app') {
10
10
  // create params
11
11
  const params = {
12
- domain: 'app.silentswap.com',
12
+ domain: `${subdomain}.silentswap.com`,
13
13
  address: user,
14
14
  statement: 'Sign in with Ethereum to SilentSwap',
15
- uri: 'https://app.silentswap.com',
15
+ uri: `shttps://${subdomain}.silentswap.com`,
16
16
  version: '1',
17
17
  chainId: 1, // always Ethereum mainnet
18
18
  nonce: nonce,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silentswap/sdk",
3
3
  "type": "module",
4
- "version": "0.0.9",
4
+ "version": "0.0.11",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "files": [