@sodax/types 2.0.0 → 2.1.0-rc.1
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/backend/index.d.ts +1 -0
- package/dist/backend/index.js +1 -0
- package/dist/backend/sponsoringApi.d.ts +62 -0
- package/dist/backend/sponsoringApi.js +12 -0
- package/dist/common/constants.d.ts +21 -5
- package/dist/common/constants.js +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/near/near-api-js.d.ts +453 -453
- package/dist/shared/features.d.ts +1 -1
- package/dist/stellar/stellar.d.ts +7 -1
- package/dist/utils/utils.js +1 -1
- package/dist/wallet/wallet.d.ts +2 -2
- package/package.json +2 -2
package/dist/backend/index.d.ts
CHANGED
package/dist/backend/index.js
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Build parameters enforced by the Stellar sponsoring service. */
|
|
2
|
+
export interface StellarSponsorConfig {
|
|
3
|
+
/** Rotatable sponsor public key; do not hardcode it in clients. */
|
|
4
|
+
sponsorAccount: string;
|
|
5
|
+
networkPassphrase: string;
|
|
6
|
+
minTotalFeeStroops: string;
|
|
7
|
+
maxTotalFeeStroops: string;
|
|
8
|
+
operationCount: number;
|
|
9
|
+
minPerOperationFeeStroops: string;
|
|
10
|
+
maxPerOperationFeeStroops: string;
|
|
11
|
+
/** Fee per operation to pass to `TransactionBuilder`. */
|
|
12
|
+
recommendedPerOperationFeeStroops: string;
|
|
13
|
+
/** Maximum distance from now to the transaction's `maxTime`, in seconds. */
|
|
14
|
+
maxTimeboundSeconds: number;
|
|
15
|
+
/** Required `createAccount.startingBalance`; do not hardcode it. */
|
|
16
|
+
requiredStartingBalance: string;
|
|
17
|
+
}
|
|
18
|
+
/** Request body for a Stellar sponsored account creation. Extra fields are rejected. */
|
|
19
|
+
export interface StellarSponsoredAccountRequest {
|
|
20
|
+
/**
|
|
21
|
+
* Base64 transaction XDR signed by the account being created.
|
|
22
|
+
* Must not be a fee-bump envelope.
|
|
23
|
+
*/
|
|
24
|
+
data: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Successful sponsored-account result. An already-active account is also a
|
|
28
|
+
* success, but has no submitted transaction hash.
|
|
29
|
+
*/
|
|
30
|
+
export type StellarSponsoredAccountResponse = {
|
|
31
|
+
hash: string;
|
|
32
|
+
alreadyActive: false;
|
|
33
|
+
} | {
|
|
34
|
+
hash: null;
|
|
35
|
+
alreadyActive: true;
|
|
36
|
+
};
|
|
37
|
+
export type SponsoringApiErrorCode = 'INVALID_SPONSOR_XDR' | 'INVALID_RESERVE_DATA' | 'SPONSOR_SEQUENCE_CONFLICT' | 'SPONSOR_TRANSACTION_REJECTED' | 'HORIZON_UNAVAILABLE' | 'SPONSOR_RATE_LIMITED' | 'SPONSOR_BUDGET_EXHAUSTED';
|
|
38
|
+
/** Runtime values used to distinguish domain codes from framework error labels. */
|
|
39
|
+
export declare const SPONSORING_API_ERROR_CODES: readonly ["INVALID_SPONSOR_XDR", "INVALID_RESERVE_DATA", "SPONSOR_SEQUENCE_CONFLICT", "SPONSOR_TRANSACTION_REJECTED", "HORIZON_UNAVAILABLE", "SPONSOR_RATE_LIMITED", "SPONSOR_BUDGET_EXHAUSTED"];
|
|
40
|
+
/**
|
|
41
|
+
* `error` may be a domain code, a framework label, or absent. Check it
|
|
42
|
+
* against {@link SPONSORING_API_ERROR_CODES} before treating it as a code.
|
|
43
|
+
*/
|
|
44
|
+
export interface SponsoringApiErrorResponse {
|
|
45
|
+
statusCode: number;
|
|
46
|
+
/** Human-readable only; do not use for control flow. */
|
|
47
|
+
message: string;
|
|
48
|
+
error?: SponsoringApiErrorCode | string;
|
|
49
|
+
/** Per-key rate-limit backoff in seconds. */
|
|
50
|
+
retryAfterSeconds?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Current sponsor sequence on a sequence conflict. Advisory because another
|
|
53
|
+
* submission can immediately make it stale.
|
|
54
|
+
*/
|
|
55
|
+
sponsorSequence?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface IStellarSponsoringApi<GetConfigArgs extends unknown[] = [], CreateAccountArgs extends unknown[] = []> {
|
|
58
|
+
/** GET /sponsorships/stellar/config */
|
|
59
|
+
getStellarSponsorConfig(...extraArgs: GetConfigArgs): Promise<StellarSponsorConfig>;
|
|
60
|
+
/** POST /sponsorships/stellar/accounts */
|
|
61
|
+
createStellarSponsoredAccount(body: StellarSponsoredAccountRequest, ...extraArgs: CreateAccountArgs): Promise<StellarSponsoredAccountResponse>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Runtime values used to distinguish domain codes from framework error labels. */
|
|
2
|
+
export const SPONSORING_API_ERROR_CODES = [
|
|
3
|
+
'INVALID_SPONSOR_XDR',
|
|
4
|
+
'INVALID_RESERVE_DATA',
|
|
5
|
+
'SPONSOR_SEQUENCE_CONFLICT',
|
|
6
|
+
'SPONSOR_TRANSACTION_REJECTED',
|
|
7
|
+
'HORIZON_UNAVAILABLE',
|
|
8
|
+
'SPONSOR_RATE_LIMITED',
|
|
9
|
+
'SPONSOR_BUDGET_EXHAUSTED',
|
|
10
|
+
];
|
|
11
|
+
// Keep the runtime list exhaustive.
|
|
12
|
+
true;
|
|
@@ -15,6 +15,12 @@ export declare const DEFAULT_BACKEND_API_HEADERS: {
|
|
|
15
15
|
};
|
|
16
16
|
export declare const DEFAULT_RELAYER_API_ENDPOINT = "https://xcall-relay.nw.iconblockchain.xyz";
|
|
17
17
|
export declare const VAULT_TOKEN_DECIMALS = 18;
|
|
18
|
+
/**
|
|
19
|
+
* Gateway base URL, including its deployment-owned version prefix.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_SPONSORING_API_ENDPOINT = "https://api.sodax.com/v1";
|
|
22
|
+
/** Stellar sponsorship route relative to the configured base URL. */
|
|
23
|
+
export declare const SPONSORING_API_STELLAR_BASE_PATH = "/sponsorships/stellar";
|
|
18
24
|
export type BaseApiConfig = {
|
|
19
25
|
baseURL: HttpUrl;
|
|
20
26
|
timeout: number;
|
|
@@ -23,18 +29,28 @@ export type BaseApiConfig = {
|
|
|
23
29
|
/** Per-endpoint config for the swaps API. Structurally identical to {@link BaseApiConfig}. */
|
|
24
30
|
export type SwapsApiConfig = BaseApiConfig;
|
|
25
31
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
* Independently routed sponsoring config. `baseURL` includes any deployment
|
|
33
|
+
* prefix; `apiKey` becomes `x-api-key`. Browser-bundled keys are public.
|
|
34
|
+
*/
|
|
35
|
+
export type SponsoringApiConfig = BaseApiConfig & {
|
|
36
|
+
apiKey?: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Independent service configs. At least one slice is required to keep this
|
|
40
|
+
* union distinct from flat {@link BaseApiConfig}.
|
|
31
41
|
*/
|
|
32
42
|
export type CustomApiConfig = {
|
|
33
43
|
baseApiConfig: BaseApiConfig;
|
|
34
44
|
swapsApiConfig?: SwapsApiConfig;
|
|
45
|
+
sponsoringApiConfig?: SponsoringApiConfig;
|
|
35
46
|
} | {
|
|
36
47
|
baseApiConfig?: BaseApiConfig;
|
|
37
48
|
swapsApiConfig: SwapsApiConfig;
|
|
49
|
+
sponsoringApiConfig?: SponsoringApiConfig;
|
|
50
|
+
} | {
|
|
51
|
+
baseApiConfig?: BaseApiConfig;
|
|
52
|
+
swapsApiConfig?: SwapsApiConfig;
|
|
53
|
+
sponsoringApiConfig: SponsoringApiConfig;
|
|
38
54
|
};
|
|
39
55
|
export type ApiConfig = BaseApiConfig | CustomApiConfig;
|
|
40
56
|
export declare const apiConfig: {
|
package/dist/common/constants.js
CHANGED
|
@@ -14,6 +14,12 @@ export const DEFAULT_BACKEND_API_HEADERS = {
|
|
|
14
14
|
};
|
|
15
15
|
export const DEFAULT_RELAYER_API_ENDPOINT = 'https://xcall-relay.nw.iconblockchain.xyz';
|
|
16
16
|
export const VAULT_TOKEN_DECIMALS = 18;
|
|
17
|
+
/**
|
|
18
|
+
* Gateway base URL, including its deployment-owned version prefix.
|
|
19
|
+
*/
|
|
20
|
+
export const DEFAULT_SPONSORING_API_ENDPOINT = 'https://api.sodax.com/v1';
|
|
21
|
+
/** Stellar sponsorship route relative to the configured base URL. */
|
|
22
|
+
export const SPONSORING_API_STELLAR_BASE_PATH = '/sponsorships/stellar';
|
|
17
23
|
export const apiConfig = {
|
|
18
24
|
baseURL: DEFAULT_BACKEND_API_ENDPOINT,
|
|
19
25
|
timeout: DEFAULT_BACKEND_API_TIMEOUT,
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -19,4 +19,4 @@ export * from './sui/index.js';
|
|
|
19
19
|
export * from './swap/index.js';
|
|
20
20
|
export * from './utils/index.js';
|
|
21
21
|
export * from './wallet/index.js';
|
|
22
|
-
export const CONFIG_VERSION =
|
|
22
|
+
export const CONFIG_VERSION = 221; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
|