@cubist-labs/cubesigner-sdk 0.4.244 → 0.4.246
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/package.json +1 -1
- package/dist/spec/env/gamma.json +5 -0
- package/dist/src/audit_log.d.ts +3 -3
- package/dist/src/client/api_client.d.ts +13 -6
- package/dist/src/client/api_client.d.ts.map +1 -1
- package/dist/src/client/api_client.js +23 -13
- package/dist/src/client/base_client.d.ts +5 -1
- package/dist/src/client/base_client.d.ts.map +1 -1
- package/dist/src/client/base_client.js +15 -9
- package/dist/src/client/session.d.ts +3 -1
- package/dist/src/client/session.d.ts.map +1 -1
- package/dist/src/client/session.js +7 -3
- package/dist/src/client.d.ts +12 -5
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +15 -4
- package/dist/src/diffie_hellman.js +2 -2
- package/dist/src/env.d.ts +7 -0
- package/dist/src/env.d.ts.map +1 -1
- package/dist/src/env.js +14 -1
- package/dist/src/key.js +3 -3
- package/dist/src/policy.d.ts +24 -7
- package/dist/src/policy.d.ts.map +1 -1
- package/dist/src/policy.js +34 -16
- package/dist/src/response.d.ts +3 -3
- package/dist/src/response.d.ts.map +1 -1
- package/dist/src/response.js +3 -6
- package/dist/src/schema.d.ts +186 -33
- package/dist/src/schema.d.ts.map +1 -1
- package/dist/src/schema.js +1 -1
- package/dist/src/schema_types.d.ts.map +1 -1
- package/dist/src/schema_types.js +2 -1
- package/dist/src/scopes.d.ts.map +1 -1
- package/dist/src/scopes.js +14 -11
- package/dist/src/user_export.d.ts +1 -1
- package/dist/src/user_export.js +3 -3
- package/dist/src/util.d.ts +7 -0
- package/dist/src/util.d.ts.map +1 -1
- package/dist/src/util.js +30 -7
- package/package.json +1 -1
- package/src/client/api_client.ts +26 -14
- package/src/client/base_client.ts +12 -2
- package/src/client/session.ts +10 -3
- package/src/client.ts +17 -4
- package/src/diffie_hellman.ts +1 -1
- package/src/env.ts +17 -0
- package/src/key.ts +2 -2
- package/src/policy.ts +34 -16
- package/src/response.ts +6 -9
- package/src/schema.ts +202 -49
- package/src/schema_types.ts +1 -0
- package/src/scopes.ts +13 -10
- package/src/user_export.ts +2 -2
- package/src/util.ts +34 -8
package/src/schema.ts
CHANGED
|
@@ -1664,6 +1664,19 @@ export interface paths {
|
|
|
1664
1664
|
*/
|
|
1665
1665
|
get: operations["userOrgs"];
|
|
1666
1666
|
};
|
|
1667
|
+
"/v1/org/{org_id}/binance/sign/{material_id}": {
|
|
1668
|
+
/**
|
|
1669
|
+
* Sign Binance RPC Request
|
|
1670
|
+
* @description Sign Binance RPC Request
|
|
1671
|
+
*
|
|
1672
|
+
* Signs a typed [`BinanceRpc`] request with the [`KeyType::Ed25519BinanceApi`]
|
|
1673
|
+
* key identified by `material_id`. The signer URL-encodes the inner request,
|
|
1674
|
+
* appends Binance's `recvWindow` and `timestamp` parameters, signs the
|
|
1675
|
+
* resulting query, and returns the full query string ready to be submitted
|
|
1676
|
+
* to Binance.
|
|
1677
|
+
*/
|
|
1678
|
+
post: operations["binanceSign"];
|
|
1679
|
+
};
|
|
1667
1680
|
"/v1/org/{org_id}/blob/sign/{key_id}": {
|
|
1668
1681
|
/**
|
|
1669
1682
|
* Sign Raw Blob
|
|
@@ -1798,7 +1811,7 @@ export interface components {
|
|
|
1798
1811
|
*/
|
|
1799
1812
|
omitZeroBalances?: boolean | null;
|
|
1800
1813
|
};
|
|
1801
|
-
/** @description Response
|
|
1814
|
+
/** @description Response returned by `cs_binanceAccountInfo`. */
|
|
1802
1815
|
AccountInfoResponse: {
|
|
1803
1816
|
/** @description Account type, e.g. `"SPOT"`. Left as `String` for forward compatibility. */
|
|
1804
1817
|
accountType: string;
|
|
@@ -3149,6 +3162,7 @@ export interface components {
|
|
|
3149
3162
|
| "BabylonRegistration"
|
|
3150
3163
|
| "BabylonStaking"
|
|
3151
3164
|
| "BabylonCovSign"
|
|
3165
|
+
| "BinanceSign"
|
|
3152
3166
|
| "BlobSign"
|
|
3153
3167
|
| "BtcMessageSign"
|
|
3154
3168
|
| "BtcSign"
|
|
@@ -3194,15 +3208,8 @@ export interface components {
|
|
|
3194
3208
|
| "RpcCreateTransaction"
|
|
3195
3209
|
| "RpcGetTransaction"
|
|
3196
3210
|
| "RpcListTransactions"
|
|
3197
|
-
| "
|
|
3198
|
-
| "
|
|
3199
|
-
| "RpcBinanceUniversalTransfer"
|
|
3200
|
-
| "RpcBinanceSubAccountAssets"
|
|
3201
|
-
| "RpcBinanceAccountInfo"
|
|
3202
|
-
| "RpcBinanceSubAccountTransferHistory"
|
|
3203
|
-
| "RpcBinanceUniversalTransferHistory"
|
|
3204
|
-
| "RpcBinanceWithdraw"
|
|
3205
|
-
| "RpcBinanceWithdrawHistory"
|
|
3211
|
+
| "RpcRetryTransaction"
|
|
3212
|
+
| "RpcBinance"
|
|
3206
3213
|
| "CustomChainRpcCall"
|
|
3207
3214
|
| "EsploraApiCall"
|
|
3208
3215
|
| "SentryApiCall"
|
|
@@ -3217,11 +3224,12 @@ export interface components {
|
|
|
3217
3224
|
dryRun?: components["schemas"]["BinanceDryRunMode"] | null;
|
|
3218
3225
|
keyId: components["schemas"]["Id"];
|
|
3219
3226
|
/**
|
|
3227
|
+
* Format: float
|
|
3220
3228
|
* @description Optional "receive window", i.e., for how long the request stays valid.
|
|
3221
3229
|
* May only be specified in milliseconds, with up to three decimal places of precision.
|
|
3222
|
-
* If omitted, defaults to
|
|
3230
|
+
* If omitted, defaults to 10000. Must not be greater than 60000.
|
|
3223
3231
|
*/
|
|
3224
|
-
recvWindow?:
|
|
3232
|
+
recvWindow?: number | null;
|
|
3225
3233
|
};
|
|
3226
3234
|
BinanceApiPropertiesPatch: {
|
|
3227
3235
|
/** @description The Binance-issued API key string. Encrypted server-side before storage. */
|
|
@@ -3233,6 +3241,18 @@ export interface components {
|
|
|
3233
3241
|
/** @description Arbitrary label. Useful for storing the corresponding API key label on the Binance side. */
|
|
3234
3242
|
label?: string | null;
|
|
3235
3243
|
};
|
|
3244
|
+
/** @description Parameters envelope for all Binance RPC methods. */
|
|
3245
|
+
BinanceDepositParams: components["schemas"]["DepositRequest"] & {
|
|
3246
|
+
dryRun?: components["schemas"]["BinanceDryRunMode"] | null;
|
|
3247
|
+
keyId: components["schemas"]["Id"];
|
|
3248
|
+
/**
|
|
3249
|
+
* Format: float
|
|
3250
|
+
* @description Optional "receive window", i.e., for how long the request stays valid.
|
|
3251
|
+
* May only be specified in milliseconds, with up to three decimal places of precision.
|
|
3252
|
+
* If omitted, defaults to 10000. Must not be greater than 60000.
|
|
3253
|
+
*/
|
|
3254
|
+
recvWindow?: number | null;
|
|
3255
|
+
};
|
|
3236
3256
|
BinanceDryRunArgs: {
|
|
3237
3257
|
/** @description The Binance API method that would have been used */
|
|
3238
3258
|
method: string;
|
|
@@ -3240,7 +3260,7 @@ export interface components {
|
|
|
3240
3260
|
url: string;
|
|
3241
3261
|
};
|
|
3242
3262
|
/**
|
|
3243
|
-
* @description Different "dry run" modes for executing Binance requests
|
|
3263
|
+
* @description Different "dry run" modes for executing Binance requests.
|
|
3244
3264
|
* @enum {string}
|
|
3245
3265
|
*/
|
|
3246
3266
|
BinanceDryRunMode: "NO_SIGN" | "NO_SUBMIT";
|
|
@@ -3293,94 +3313,118 @@ export interface components {
|
|
|
3293
3313
|
/** @enum {string} */
|
|
3294
3314
|
method: "cs_binanceWithdrawHistory";
|
|
3295
3315
|
params: components["schemas"]["BinanceWithdrawHistoryParams"];
|
|
3316
|
+
}
|
|
3317
|
+
| {
|
|
3318
|
+
/** @enum {string} */
|
|
3319
|
+
method: "cs_binanceDeposit";
|
|
3320
|
+
params: components["schemas"]["BinanceDepositParams"];
|
|
3296
3321
|
};
|
|
3322
|
+
/** @description Response returned by the typed `binance_sign` endpoint. */
|
|
3323
|
+
BinanceSignResponse: {
|
|
3324
|
+
/** @description Optional policy evaluation tree. */
|
|
3325
|
+
policy_eval_tree?: unknown;
|
|
3326
|
+
} & {
|
|
3327
|
+
/**
|
|
3328
|
+
* @description The full signed query string, ready to be submitted to Binance.
|
|
3329
|
+
* Encoded as `<urlencoded params>&recvWindow=<ms>×tamp=<ms>&signature=<urlencoded base64 sig>`.
|
|
3330
|
+
*/
|
|
3331
|
+
signed_query: string;
|
|
3332
|
+
};
|
|
3297
3333
|
/** @description Parameters envelope for all Binance RPC methods. */
|
|
3298
3334
|
BinanceSubAccountAssetsParams: components["schemas"]["SubAccountAssetsRequest"] & {
|
|
3299
3335
|
dryRun?: components["schemas"]["BinanceDryRunMode"] | null;
|
|
3300
3336
|
keyId: components["schemas"]["Id"];
|
|
3301
3337
|
/**
|
|
3338
|
+
* Format: float
|
|
3302
3339
|
* @description Optional "receive window", i.e., for how long the request stays valid.
|
|
3303
3340
|
* May only be specified in milliseconds, with up to three decimal places of precision.
|
|
3304
|
-
* If omitted, defaults to
|
|
3341
|
+
* If omitted, defaults to 10000. Must not be greater than 60000.
|
|
3305
3342
|
*/
|
|
3306
|
-
recvWindow?:
|
|
3343
|
+
recvWindow?: number | null;
|
|
3307
3344
|
};
|
|
3308
3345
|
/** @description Parameters envelope for all Binance RPC methods. */
|
|
3309
3346
|
BinanceSubAccountTransferHistoryParams: components["schemas"]["SubAccountTransferHistoryRequest"] & {
|
|
3310
3347
|
dryRun?: components["schemas"]["BinanceDryRunMode"] | null;
|
|
3311
3348
|
keyId: components["schemas"]["Id"];
|
|
3312
3349
|
/**
|
|
3350
|
+
* Format: float
|
|
3313
3351
|
* @description Optional "receive window", i.e., for how long the request stays valid.
|
|
3314
3352
|
* May only be specified in milliseconds, with up to three decimal places of precision.
|
|
3315
|
-
* If omitted, defaults to
|
|
3353
|
+
* If omitted, defaults to 10000. Must not be greater than 60000.
|
|
3316
3354
|
*/
|
|
3317
|
-
recvWindow?:
|
|
3355
|
+
recvWindow?: number | null;
|
|
3318
3356
|
};
|
|
3319
3357
|
/** @description Parameters envelope for all Binance RPC methods. */
|
|
3320
3358
|
BinanceSubToMasterParams: components["schemas"]["SubToMasterRequest"] & {
|
|
3321
3359
|
dryRun?: components["schemas"]["BinanceDryRunMode"] | null;
|
|
3322
3360
|
keyId: components["schemas"]["Id"];
|
|
3323
3361
|
/**
|
|
3362
|
+
* Format: float
|
|
3324
3363
|
* @description Optional "receive window", i.e., for how long the request stays valid.
|
|
3325
3364
|
* May only be specified in milliseconds, with up to three decimal places of precision.
|
|
3326
|
-
* If omitted, defaults to
|
|
3365
|
+
* If omitted, defaults to 10000. Must not be greater than 60000.
|
|
3327
3366
|
*/
|
|
3328
|
-
recvWindow?:
|
|
3367
|
+
recvWindow?: number | null;
|
|
3329
3368
|
};
|
|
3330
3369
|
/** @description Parameters envelope for all Binance RPC methods. */
|
|
3331
3370
|
BinanceSubToSubParams: components["schemas"]["SubToSubRequest"] & {
|
|
3332
3371
|
dryRun?: components["schemas"]["BinanceDryRunMode"] | null;
|
|
3333
3372
|
keyId: components["schemas"]["Id"];
|
|
3334
3373
|
/**
|
|
3374
|
+
* Format: float
|
|
3335
3375
|
* @description Optional "receive window", i.e., for how long the request stays valid.
|
|
3336
3376
|
* May only be specified in milliseconds, with up to three decimal places of precision.
|
|
3337
|
-
* If omitted, defaults to
|
|
3377
|
+
* If omitted, defaults to 10000. Must not be greater than 60000.
|
|
3338
3378
|
*/
|
|
3339
|
-
recvWindow?:
|
|
3379
|
+
recvWindow?: number | null;
|
|
3340
3380
|
};
|
|
3341
3381
|
/** @description Parameters envelope for all Binance RPC methods. */
|
|
3342
3382
|
BinanceUniversalTransferHistoryParams: components["schemas"]["UniversalTransferHistoryRequest"] & {
|
|
3343
3383
|
dryRun?: components["schemas"]["BinanceDryRunMode"] | null;
|
|
3344
3384
|
keyId: components["schemas"]["Id"];
|
|
3345
3385
|
/**
|
|
3386
|
+
* Format: float
|
|
3346
3387
|
* @description Optional "receive window", i.e., for how long the request stays valid.
|
|
3347
3388
|
* May only be specified in milliseconds, with up to three decimal places of precision.
|
|
3348
|
-
* If omitted, defaults to
|
|
3389
|
+
* If omitted, defaults to 10000. Must not be greater than 60000.
|
|
3349
3390
|
*/
|
|
3350
|
-
recvWindow?:
|
|
3391
|
+
recvWindow?: number | null;
|
|
3351
3392
|
};
|
|
3352
3393
|
/** @description Parameters envelope for all Binance RPC methods. */
|
|
3353
3394
|
BinanceUniversalTransferParams: components["schemas"]["UniversalTransferRequest"] & {
|
|
3354
3395
|
dryRun?: components["schemas"]["BinanceDryRunMode"] | null;
|
|
3355
3396
|
keyId: components["schemas"]["Id"];
|
|
3356
3397
|
/**
|
|
3398
|
+
* Format: float
|
|
3357
3399
|
* @description Optional "receive window", i.e., for how long the request stays valid.
|
|
3358
3400
|
* May only be specified in milliseconds, with up to three decimal places of precision.
|
|
3359
|
-
* If omitted, defaults to
|
|
3401
|
+
* If omitted, defaults to 10000. Must not be greater than 60000.
|
|
3360
3402
|
*/
|
|
3361
|
-
recvWindow?:
|
|
3403
|
+
recvWindow?: number | null;
|
|
3362
3404
|
};
|
|
3363
3405
|
/** @description Parameters envelope for all Binance RPC methods. */
|
|
3364
3406
|
BinanceWithdrawHistoryParams: components["schemas"]["WithdrawHistoryRequest"] & {
|
|
3365
3407
|
dryRun?: components["schemas"]["BinanceDryRunMode"] | null;
|
|
3366
3408
|
keyId: components["schemas"]["Id"];
|
|
3367
3409
|
/**
|
|
3410
|
+
* Format: float
|
|
3368
3411
|
* @description Optional "receive window", i.e., for how long the request stays valid.
|
|
3369
3412
|
* May only be specified in milliseconds, with up to three decimal places of precision.
|
|
3370
|
-
* If omitted, defaults to
|
|
3413
|
+
* If omitted, defaults to 10000. Must not be greater than 60000.
|
|
3371
3414
|
*/
|
|
3372
|
-
recvWindow?:
|
|
3415
|
+
recvWindow?: number | null;
|
|
3373
3416
|
};
|
|
3374
3417
|
/** @description Parameters envelope for all Binance RPC methods. */
|
|
3375
3418
|
BinanceWithdrawParams: components["schemas"]["WithdrawRequest"] & {
|
|
3376
3419
|
dryRun?: components["schemas"]["BinanceDryRunMode"] | null;
|
|
3377
3420
|
keyId: components["schemas"]["Id"];
|
|
3378
3421
|
/**
|
|
3422
|
+
* Format: float
|
|
3379
3423
|
* @description Optional "receive window", i.e., for how long the request stays valid.
|
|
3380
3424
|
* May only be specified in milliseconds, with up to three decimal places of precision.
|
|
3381
|
-
* If omitted, defaults to
|
|
3425
|
+
* If omitted, defaults to 10000. Must not be greater than 60000.
|
|
3382
3426
|
*/
|
|
3383
|
-
recvWindow?:
|
|
3427
|
+
recvWindow?: number | null;
|
|
3384
3428
|
};
|
|
3385
3429
|
/** @description A bitcoin address and its network. */
|
|
3386
3430
|
BitcoinAddressInfo: {
|
|
@@ -4157,6 +4201,11 @@ export interface components {
|
|
|
4157
4201
|
method: "cs_createTransaction";
|
|
4158
4202
|
params: components["schemas"]["CreateTransactionRequest"];
|
|
4159
4203
|
},
|
|
4204
|
+
{
|
|
4205
|
+
/** @enum {string} */
|
|
4206
|
+
method: "cs_retryTransaction";
|
|
4207
|
+
params: components["schemas"]["RetryTransactionRequest"];
|
|
4208
|
+
},
|
|
4160
4209
|
{
|
|
4161
4210
|
/** @enum {string} */
|
|
4162
4211
|
method: "cs_getTransaction";
|
|
@@ -4201,6 +4250,40 @@ export interface components {
|
|
|
4201
4250
|
/** @description Custom EVM chains. */
|
|
4202
4251
|
evm: components["schemas"]["EvmCustomChain"][];
|
|
4203
4252
|
};
|
|
4253
|
+
/**
|
|
4254
|
+
* @description Parameters for `GET /sapi/v1/capital/deposit/address`.
|
|
4255
|
+
*
|
|
4256
|
+
* Fetches the deposit address for `coin` on the account that the signing key
|
|
4257
|
+
* authenticates as. Optionally narrows the address to a specific `network`.
|
|
4258
|
+
*/
|
|
4259
|
+
DepositRequest: {
|
|
4260
|
+
/**
|
|
4261
|
+
* @description Required only when `network` is `"LIGHTNING"`: the deposit amount that
|
|
4262
|
+
* the returned invoice should encode, as a decimal string.
|
|
4263
|
+
*/
|
|
4264
|
+
amount?: string | null;
|
|
4265
|
+
/** @description The asset symbol whose deposit address to fetch (e.g. `"USDT"`, `"BTC"`). */
|
|
4266
|
+
coin: string;
|
|
4267
|
+
/**
|
|
4268
|
+
* @description Network identifier (e.g. `"BSC"`, `"ETH"`). If omitted, Binance returns
|
|
4269
|
+
* the address on the asset's default network.
|
|
4270
|
+
*/
|
|
4271
|
+
network?: string | null;
|
|
4272
|
+
};
|
|
4273
|
+
/** @description Response returned by `cs_binanceDeposit`. */
|
|
4274
|
+
DepositResponse: {
|
|
4275
|
+
/** @description Deposit address. */
|
|
4276
|
+
address: string;
|
|
4277
|
+
/** @description Asset symbol (echoes [`DepositRequest::coin`]). */
|
|
4278
|
+
coin: string;
|
|
4279
|
+
/**
|
|
4280
|
+
* @description Secondary address identifier required by some assets (e.g. memo for
|
|
4281
|
+
* XRP, tag for XLM). Empty string when the asset does not use one.
|
|
4282
|
+
*/
|
|
4283
|
+
tag: string;
|
|
4284
|
+
/** @description Blockchain explorer URL for `address`. */
|
|
4285
|
+
url: string;
|
|
4286
|
+
};
|
|
4204
4287
|
/**
|
|
4205
4288
|
* @description Information produced by a successful deposit
|
|
4206
4289
|
* @example {
|
|
@@ -4935,6 +5018,11 @@ export interface components {
|
|
|
4935
5018
|
};
|
|
4936
5019
|
/** @description EVM-specific transaction details. */
|
|
4937
5020
|
EvmTransactionDetails: {
|
|
5021
|
+
/**
|
|
5022
|
+
* Format: int64
|
|
5023
|
+
* @description The EVM chain id for the chain the transaction is submitted to.
|
|
5024
|
+
*/
|
|
5025
|
+
chain_id: number;
|
|
4938
5026
|
/**
|
|
4939
5027
|
* @description The transaction hash, as submitted to the chain.
|
|
4940
5028
|
*
|
|
@@ -4998,8 +5086,7 @@ export interface components {
|
|
|
4998
5086
|
/**
|
|
4999
5087
|
* @description Optional nonce.
|
|
5000
5088
|
*
|
|
5001
|
-
* If not specified, the
|
|
5002
|
-
* used.
|
|
5089
|
+
* If not specified, the next available nonce is used.
|
|
5003
5090
|
*/
|
|
5004
5091
|
nonce?: string | null;
|
|
5005
5092
|
};
|
|
@@ -5035,6 +5122,17 @@ export interface components {
|
|
|
5035
5122
|
ExplicitScope:
|
|
5036
5123
|
| "sign:*"
|
|
5037
5124
|
| "sign:ava"
|
|
5125
|
+
| "sign:binance:*"
|
|
5126
|
+
| "sign:binance:subToMaster"
|
|
5127
|
+
| "sign:binance:subToSub"
|
|
5128
|
+
| "sign:binance:universalTransfer"
|
|
5129
|
+
| "sign:binance:subAccountAssets"
|
|
5130
|
+
| "sign:binance:accountInfo"
|
|
5131
|
+
| "sign:binance:subAccountTransferHistory"
|
|
5132
|
+
| "sign:binance:universalTransferHistory"
|
|
5133
|
+
| "sign:binance:withdraw"
|
|
5134
|
+
| "sign:binance:withdrawHistory"
|
|
5135
|
+
| "sign:binance:deposit"
|
|
5038
5136
|
| "sign:blob"
|
|
5039
5137
|
| "sign:diffieHellman"
|
|
5040
5138
|
| "sign:btc:*"
|
|
@@ -5264,18 +5362,10 @@ export interface components {
|
|
|
5264
5362
|
| "rpc:*"
|
|
5265
5363
|
| "rpc:createTransaction:*"
|
|
5266
5364
|
| "rpc:createTransaction:evm"
|
|
5365
|
+
| "rpc:retryTransaction"
|
|
5267
5366
|
| "rpc:getTransaction"
|
|
5268
5367
|
| "rpc:listTransactions"
|
|
5269
|
-
| "rpc:binance
|
|
5270
|
-
| "rpc:binance:subToMaster"
|
|
5271
|
-
| "rpc:binance:subToSub"
|
|
5272
|
-
| "rpc:binance:universalTransfer"
|
|
5273
|
-
| "rpc:binance:subAccountAssets"
|
|
5274
|
-
| "rpc:binance:accountInfo"
|
|
5275
|
-
| "rpc:binance:subAccountTransferHistory"
|
|
5276
|
-
| "rpc:binance:universalTransferHistory"
|
|
5277
|
-
| "rpc:binance:withdraw"
|
|
5278
|
-
| "rpc:binance:withdrawHistory";
|
|
5368
|
+
| "rpc:binance";
|
|
5279
5369
|
/**
|
|
5280
5370
|
* @description This type specifies the interpretation of the `fee` field in Babylon
|
|
5281
5371
|
* staking requests. If `sats`, the field is intpreted as a fixed value
|
|
@@ -5969,7 +6059,8 @@ export interface components {
|
|
|
5969
6059
|
| components["schemas"]["SubAccountTransferHistoryResponse"]
|
|
5970
6060
|
| components["schemas"]["UniversalTransferHistoryResponse"]
|
|
5971
6061
|
| components["schemas"]["WithdrawResponse"]
|
|
5972
|
-
| components["schemas"]["WithdrawHistoryResponse"]
|
|
6062
|
+
| components["schemas"]["WithdrawHistoryResponse"]
|
|
6063
|
+
| components["schemas"]["DepositResponse"];
|
|
5973
6064
|
JwkSetResponse: {
|
|
5974
6065
|
/** @description The keys included in this set */
|
|
5975
6066
|
keys: Record<string, never>[];
|
|
@@ -6583,6 +6674,7 @@ export interface components {
|
|
|
6583
6674
|
| "BabylonCovSign"
|
|
6584
6675
|
| "BabylonRegistration"
|
|
6585
6676
|
| "BabylonStaking"
|
|
6677
|
+
| "BinanceSign"
|
|
6586
6678
|
| "BlobSign"
|
|
6587
6679
|
| "BtcMessageSign"
|
|
6588
6680
|
| "BtcSign"
|
|
@@ -8300,6 +8392,11 @@ export interface components {
|
|
|
8300
8392
|
RestrictedActionsMap: {
|
|
8301
8393
|
[key: string]: components["schemas"]["MemberRole"][];
|
|
8302
8394
|
};
|
|
8395
|
+
/** @description Parameters for the [`cs_retryTransaction`](RpcMethod::RetryTransaction) method. */
|
|
8396
|
+
RetryTransactionRequest: components["schemas"]["EvmTxCustomization"] & {
|
|
8397
|
+
/** @description The transaction id. */
|
|
8398
|
+
id: string;
|
|
8399
|
+
};
|
|
8303
8400
|
/**
|
|
8304
8401
|
* @description List of role actions that can be restricted to a set of member roles
|
|
8305
8402
|
* @enum {string}
|
|
@@ -8789,7 +8886,7 @@ export interface components {
|
|
|
8789
8886
|
/** @description Email address of the sub-account whose balances to fetch. */
|
|
8790
8887
|
email: string;
|
|
8791
8888
|
};
|
|
8792
|
-
/** @description Response
|
|
8889
|
+
/** @description Response returned by `cs_binanceSubAccountAssets`. */
|
|
8793
8890
|
SubAccountAssetsResponse: {
|
|
8794
8891
|
/**
|
|
8795
8892
|
* @description One entry per asset held in the sub-account's spot wallet. Binance
|
|
@@ -8877,13 +8974,13 @@ export interface components {
|
|
|
8877
8974
|
type?: number | null;
|
|
8878
8975
|
};
|
|
8879
8976
|
/**
|
|
8880
|
-
* @description Response
|
|
8977
|
+
* @description Response returned by `cs_binanceSubAccountTransferHistory`.
|
|
8881
8978
|
*
|
|
8882
8979
|
* Binance returns a top-level JSON array; this newtype preserves that wire
|
|
8883
8980
|
* format while giving the response a named type in the OpenAPI schema.
|
|
8884
8981
|
*/
|
|
8885
8982
|
SubAccountTransferHistoryResponse: components["schemas"]["SubAccountTransferHistoryEntry"][];
|
|
8886
|
-
/** @description Response
|
|
8983
|
+
/** @description Response returned by `cs_binanceSubToMaster` and `cs_binanceSubToSub`. */
|
|
8887
8984
|
SubAccountTransferResponse: {
|
|
8888
8985
|
/** Format: int64 */
|
|
8889
8986
|
txnId: number;
|
|
@@ -9393,7 +9490,7 @@ export interface components {
|
|
|
9393
9490
|
/** @description Filter to transfers destined for this sub-account email. */
|
|
9394
9491
|
toEmail?: string | null;
|
|
9395
9492
|
};
|
|
9396
|
-
/** @description Response
|
|
9493
|
+
/** @description Response returned by `cs_binanceUniversalTransferHistory`. */
|
|
9397
9494
|
UniversalTransferHistoryResponse: {
|
|
9398
9495
|
/** @description Transfers in the current page. */
|
|
9399
9496
|
result: components["schemas"]["UniversalTransferHistoryEntry"][];
|
|
@@ -9430,7 +9527,7 @@ export interface components {
|
|
|
9430
9527
|
/** @description Destination sub-account email. If `None`, the destination is the master account. */
|
|
9431
9528
|
toEmail?: string | null;
|
|
9432
9529
|
};
|
|
9433
|
-
/** @description Response
|
|
9530
|
+
/** @description Response returned by `cs_binanceUniversalTransfer`. */
|
|
9434
9531
|
UniversalTransferResponse: {
|
|
9435
9532
|
clientTranId?: string | null;
|
|
9436
9533
|
/** Format: int64 */
|
|
@@ -10327,7 +10424,7 @@ export interface components {
|
|
|
10327
10424
|
withdrawOrderId?: string | null;
|
|
10328
10425
|
};
|
|
10329
10426
|
/**
|
|
10330
|
-
* @description Response
|
|
10427
|
+
* @description Response returned by `cs_binanceWithdrawHistory`.
|
|
10331
10428
|
*
|
|
10332
10429
|
* Binance returns a top-level JSON array; this newtype preserves that wire
|
|
10333
10430
|
* format while giving the response a named type in the OpenAPI schema.
|
|
@@ -10378,7 +10475,7 @@ export interface components {
|
|
|
10378
10475
|
*/
|
|
10379
10476
|
withdrawOrderId?: string | null;
|
|
10380
10477
|
};
|
|
10381
|
-
/** @description Response
|
|
10478
|
+
/** @description Response returned by `cs_binanceWithdraw`. */
|
|
10382
10479
|
WithdrawResponse: {
|
|
10383
10480
|
/**
|
|
10384
10481
|
* @description Binance-assigned withdrawal id. Used to look the request up later via
|
|
@@ -10511,6 +10608,21 @@ export interface components {
|
|
|
10511
10608
|
};
|
|
10512
10609
|
};
|
|
10513
10610
|
};
|
|
10611
|
+
/** @description Response returned by the typed `binance_sign` endpoint. */
|
|
10612
|
+
BinanceSignResponse: {
|
|
10613
|
+
content: {
|
|
10614
|
+
"application/json": {
|
|
10615
|
+
/** @description Optional policy evaluation tree. */
|
|
10616
|
+
policy_eval_tree?: unknown;
|
|
10617
|
+
} & {
|
|
10618
|
+
/**
|
|
10619
|
+
* @description The full signed query string, ready to be submitted to Binance.
|
|
10620
|
+
* Encoded as `<urlencoded params>&recvWindow=<ms>×tamp=<ms>&signature=<urlencoded base64 sig>`.
|
|
10621
|
+
*/
|
|
10622
|
+
signed_query: string;
|
|
10623
|
+
};
|
|
10624
|
+
};
|
|
10625
|
+
};
|
|
10514
10626
|
/** @description BTC message signing response */
|
|
10515
10627
|
BtcMessageSignResponse: {
|
|
10516
10628
|
content: {
|
|
@@ -17865,6 +17977,47 @@ export interface operations {
|
|
|
17865
17977
|
};
|
|
17866
17978
|
};
|
|
17867
17979
|
};
|
|
17980
|
+
/**
|
|
17981
|
+
* Sign Binance RPC Request
|
|
17982
|
+
* @description Sign Binance RPC Request
|
|
17983
|
+
*
|
|
17984
|
+
* Signs a typed [`BinanceRpc`] request with the [`KeyType::Ed25519BinanceApi`]
|
|
17985
|
+
* key identified by `material_id`. The signer URL-encodes the inner request,
|
|
17986
|
+
* appends Binance's `recvWindow` and `timestamp` parameters, signs the
|
|
17987
|
+
* resulting query, and returns the full query string ready to be submitted
|
|
17988
|
+
* to Binance.
|
|
17989
|
+
*/
|
|
17990
|
+
binanceSign: {
|
|
17991
|
+
parameters: {
|
|
17992
|
+
path: {
|
|
17993
|
+
/**
|
|
17994
|
+
* @description Name or ID of the desired Org
|
|
17995
|
+
* @example Org#124dfe3e-3bbd-487d-80c0-53c55e8ab87a
|
|
17996
|
+
*/
|
|
17997
|
+
org_id: string;
|
|
17998
|
+
/** @description Material id of the Ed25519BinanceApi key */
|
|
17999
|
+
material_id: string;
|
|
18000
|
+
};
|
|
18001
|
+
};
|
|
18002
|
+
requestBody: {
|
|
18003
|
+
content: {
|
|
18004
|
+
"application/json": components["schemas"]["BinanceRpc"];
|
|
18005
|
+
};
|
|
18006
|
+
};
|
|
18007
|
+
responses: {
|
|
18008
|
+
200: components["responses"]["BinanceSignResponse"];
|
|
18009
|
+
202: {
|
|
18010
|
+
content: {
|
|
18011
|
+
"application/json": components["schemas"]["AcceptedResponse"];
|
|
18012
|
+
};
|
|
18013
|
+
};
|
|
18014
|
+
default: {
|
|
18015
|
+
content: {
|
|
18016
|
+
"application/json": components["schemas"]["ErrorResponse"];
|
|
18017
|
+
};
|
|
18018
|
+
};
|
|
18019
|
+
};
|
|
18020
|
+
};
|
|
17868
18021
|
/**
|
|
17869
18022
|
* Sign Raw Blob
|
|
17870
18023
|
* @description Sign Raw Blob
|
package/src/schema_types.ts
CHANGED
package/src/scopes.ts
CHANGED
|
@@ -30,6 +30,17 @@ export const AllScopes: Record<ExplicitScope, string> =
|
|
|
30
30
|
"sign:btc:message:*" : "Allows access to the BTC message signing endpoint for any key type",
|
|
31
31
|
"sign:btc:message:segwit" : "Allows access to the BTC message signing endpoint for segwit keys",
|
|
32
32
|
"sign:btc:message:legacy" : "Allows access to the BTC message signing endpoint for legacy keys",
|
|
33
|
+
"sign:binance:*" : "Allows access to the Binance sign endpoint, without restrictions",
|
|
34
|
+
"sign:binance:accountInfo" : "Allows access to the Binance sign endpoint, restricted to the 'AccountInfo' operation",
|
|
35
|
+
"sign:binance:deposit" : "Allows access to the Binance sign endpoint, restricted to the 'Deposit' method",
|
|
36
|
+
"sign:binance:subAccountAssets" : "Allows access to the Binance sign endpoint, restricted to the 'SubAccountAssets' operation",
|
|
37
|
+
"sign:binance:subAccountTransferHistory" : "Allows access to the Binance sign endpoint, restricted to the 'SubAccountTransferHistory' operation",
|
|
38
|
+
"sign:binance:subToMaster" : "Allows access to the Binance sign endpoint, restricted to the 'SubToMaster' operation",
|
|
39
|
+
"sign:binance:subToSub" : "Allows access to the Binance sign endpoint, restricted to the 'SubToSub' operation",
|
|
40
|
+
"sign:binance:universalTransfer" : "Allows access to the Binance sign endpoint, restricted to the 'UniversalTransfer' operation",
|
|
41
|
+
"sign:binance:universalTransferHistory" : "Allows access to the Binance sign endpoint, restricted to the 'UniversalTransferHistory' operation",
|
|
42
|
+
"sign:binance:withdraw" : "Allows access to the Binance sign endpoint, restricted to the 'Withdraw' operation",
|
|
43
|
+
"sign:binance:withdrawHistory" : "Allows access to the Binance sign endpoint, restricted to the 'WithdrawHistory' operation",
|
|
33
44
|
"sign:babylon:*" : "Allows access to all Babylon endpoints",
|
|
34
45
|
"sign:babylon:eots:*" : "Allows access to all Babylon EOTS endpoints",
|
|
35
46
|
"sign:babylon:eots:nonces" : "Allows access to the EOTS nonce generation endpoint",
|
|
@@ -247,16 +258,8 @@ export const AllScopes: Record<ExplicitScope, string> =
|
|
|
247
258
|
"rpc:createTransaction:evm" : "Allows access to the RPC API endpoint, but only for the 'cs_createTransaction' function with an EVM transaction request.",
|
|
248
259
|
"rpc:getTransaction" : "Allows access to the RPC API endpoint, but only for the 'cs_getTransaction' function.",
|
|
249
260
|
"rpc:listTransactions" : "Allows access to the RPC API endpoint, but only for the 'cs_listTransactions' function.",
|
|
250
|
-
"rpc:
|
|
251
|
-
"rpc:binance
|
|
252
|
-
"rpc:binance:subToSub" : "Allows access to the RPC API endpoint, but only for the 'cs_binanceSubToSub' function.",
|
|
253
|
-
"rpc:binance:universalTransfer" : "Allows access to the RPC API endpoint, but only for the 'cs_binanceUniversalTransfer' function.",
|
|
254
|
-
"rpc:binance:subAccountAssets" : "Allows access to the RPC API endpoint, but only for the 'cs_binanceSubAccountAssets' function.",
|
|
255
|
-
"rpc:binance:accountInfo" : "Allows access to the RPC API endpoint, but only for the 'cs_binanceAccountInfo' function.",
|
|
256
|
-
"rpc:binance:subAccountTransferHistory" : "Allows access to the RPC API endpoint, but only for the 'cs_binanceSubAccountTransferHistory' function.",
|
|
257
|
-
"rpc:binance:universalTransferHistory" : "Allows access to the RPC API endpoint, but only for the 'cs_binanceUniversalTransferHistory' function.",
|
|
258
|
-
"rpc:binance:withdraw" : "Allows access to the RPC API endpoint, but only for the 'cs_binanceWithdraw' function.",
|
|
259
|
-
"rpc:binance:withdrawHistory" : "Allows access to the RPC API endpoint, but only for the 'cs_binanceWithdrawHistory' function.",
|
|
261
|
+
"rpc:retryTransaction" : "Allows access to the RPC API endpoint, but only for the 'cs_retryTransaction' function",
|
|
262
|
+
"rpc:binance" : "Allows access to the RPC API endpoint, but only for the 'cs_binance*' functions",
|
|
260
263
|
};
|
|
261
264
|
|
|
262
265
|
// Const for scope category labels
|
package/src/user_export.ts
CHANGED
|
@@ -27,7 +27,7 @@ export async function userExportKeygen(): Promise<CryptoKeyPair> {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* Get the ArrayBuffer slice represented by a
|
|
30
|
+
* Get the ArrayBuffer slice represented by a Uint8Array
|
|
31
31
|
*
|
|
32
32
|
* @param b The buffer to convert
|
|
33
33
|
* @returns The resulting ArrayBuffer
|
|
@@ -52,7 +52,7 @@ export async function userExportDecrypt(
|
|
|
52
52
|
|
|
53
53
|
// decrypt the export ciphertext using the HPKE one-shot API
|
|
54
54
|
const tenc = new TextEncoder();
|
|
55
|
-
const tdec = new TextDecoder();
|
|
55
|
+
const tdec = new TextDecoder("utf-8");
|
|
56
56
|
const info = toArrayBuffer(tenc.encode(`cubist-signer::UserExportOwner::${response.user_id}`));
|
|
57
57
|
const public_key = toArrayBuffer(decodeBase64(response.ephemeral_public_key));
|
|
58
58
|
const ctxt = toArrayBuffer(decodeBase64(response.encrypted_key_material));
|
package/src/util.ts
CHANGED
|
@@ -27,6 +27,9 @@ export function pathJoin(dir: string, file: string): string {
|
|
|
27
27
|
return `${dir}${sep}${file}`;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
// eslint-disable-next-line no-restricted-globals -- intentionally checking for Buffer before using it
|
|
31
|
+
const nodeBuffer = typeof Buffer === "function" ? Buffer : undefined;
|
|
32
|
+
|
|
30
33
|
/**
|
|
31
34
|
* Browser-friendly helper for decoding a 'base64'-encoded string into a byte array.
|
|
32
35
|
*
|
|
@@ -34,8 +37,8 @@ export function pathJoin(dir: string, file: string): string {
|
|
|
34
37
|
* @returns Decoded byte array
|
|
35
38
|
*/
|
|
36
39
|
export function decodeBase64(b64: string): Uint8Array {
|
|
37
|
-
return
|
|
38
|
-
?
|
|
40
|
+
return nodeBuffer
|
|
41
|
+
? nodeBuffer.from(b64, "base64")
|
|
39
42
|
: Uint8Array.from(atob(b64), (c) => c.charCodeAt(0));
|
|
40
43
|
}
|
|
41
44
|
|
|
@@ -60,10 +63,9 @@ export function decodeBase64Url(b64url: string): Uint8Array {
|
|
|
60
63
|
*/
|
|
61
64
|
export function encodeToBase64(buffer: Iterable<number> | ArrayBuffer): string {
|
|
62
65
|
const bytes = buffer instanceof ArrayBuffer ? new Uint8Array(buffer) : new Uint8Array(buffer);
|
|
63
|
-
const b64 =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
: btoa(bytes.reduce((s, b) => s + String.fromCharCode(b), ""));
|
|
66
|
+
const b64 = nodeBuffer
|
|
67
|
+
? nodeBuffer.from(bytes).toString("base64")
|
|
68
|
+
: btoa(bytes.reduce((s, b) => s + String.fromCharCode(b), ""));
|
|
67
69
|
return b64;
|
|
68
70
|
}
|
|
69
71
|
|
|
@@ -97,6 +99,30 @@ export function delay(ms: number): Promise<void> {
|
|
|
97
99
|
* @returns Hex string prefixed with "0x"
|
|
98
100
|
*/
|
|
99
101
|
export function encodeToHex(message: string | Uint8Array): string {
|
|
100
|
-
const
|
|
101
|
-
return "0x" +
|
|
102
|
+
const bytes = typeof message === "string" ? new TextEncoder().encode(message) : message;
|
|
103
|
+
return "0x" + Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Decodes a hex string into a byte array.
|
|
108
|
+
*
|
|
109
|
+
* @param hex The hex string to decode, with or without a "0x" prefix
|
|
110
|
+
* @returns Decoded byte array
|
|
111
|
+
*/
|
|
112
|
+
export function decodeFromHex(hex: string): Uint8Array {
|
|
113
|
+
const clean = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
114
|
+
|
|
115
|
+
if (clean.length % 2 !== 0) {
|
|
116
|
+
throw new Error(`Invalid hexadecimal string length, must be even: ${clean.length}`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!/^[0-9a-fA-F]*$/.test(clean)) {
|
|
120
|
+
throw new Error(`Invalid hexadecimal character in: '${clean}'`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const bytes = new Uint8Array(clean.length / 2);
|
|
124
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
125
|
+
bytes[i] = parseInt(clean.slice(i * 2, i * 2 + 2), 16);
|
|
126
|
+
}
|
|
127
|
+
return bytes;
|
|
102
128
|
}
|