@nightlylabs/dex-sdk 0.0.2 → 0.0.4
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.cjs +16 -3
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +10 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45,7 +45,12 @@ __export(index_exports, {
|
|
|
45
45
|
TestFaucet: () => TestFaucet,
|
|
46
46
|
TradeRole: () => TradeRole,
|
|
47
47
|
UserStatus: () => UserStatus,
|
|
48
|
-
|
|
48
|
+
generateApiKey: () => generateApiKey,
|
|
49
|
+
getRandomId: () => getRandomId,
|
|
50
|
+
getTopicFromCommand: () => getTopicFromCommand,
|
|
51
|
+
getTopicFromMessage: () => getTopicFromMessage,
|
|
52
|
+
sleep: () => sleep,
|
|
53
|
+
toSystemValue: () => toSystemValue
|
|
49
54
|
});
|
|
50
55
|
module.exports = __toCommonJS(index_exports);
|
|
51
56
|
|
|
@@ -467,6 +472,7 @@ var GLOBAL_DENOMINATOR = 1e8;
|
|
|
467
472
|
|
|
468
473
|
// src/utils.ts
|
|
469
474
|
var import_decimal = require("decimal.js");
|
|
475
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
470
476
|
var toSystemValue = (value) => {
|
|
471
477
|
return new import_decimal.Decimal(value).mul(new import_decimal.Decimal(GLOBAL_DENOMINATOR)).toString();
|
|
472
478
|
};
|
|
@@ -498,6 +504,7 @@ var getTopicFromMessage = (data) => {
|
|
|
498
504
|
case "OracleUpdates":
|
|
499
505
|
return data.type;
|
|
500
506
|
}
|
|
507
|
+
throw new Error("Invalid message type");
|
|
501
508
|
};
|
|
502
509
|
|
|
503
510
|
// src/client.ts
|
|
@@ -694,8 +701,9 @@ var Client = class _Client {
|
|
|
694
701
|
functionArguments: [params.name, params.referralId],
|
|
695
702
|
typeArguments: []
|
|
696
703
|
});
|
|
697
|
-
const tx = await this._aptos.transaction.build.
|
|
704
|
+
const tx = await this._aptos.transaction.build.multiAgent({
|
|
698
705
|
sender: params.sender,
|
|
706
|
+
secondarySignerAddresses: [apiKey.accountAddress],
|
|
699
707
|
data: payload
|
|
700
708
|
});
|
|
701
709
|
const signature = this._aptos.sign({
|
|
@@ -1302,5 +1310,10 @@ var TestFaucet = class _TestFaucet extends client_default {
|
|
|
1302
1310
|
TestFaucet,
|
|
1303
1311
|
TradeRole,
|
|
1304
1312
|
UserStatus,
|
|
1305
|
-
|
|
1313
|
+
generateApiKey,
|
|
1314
|
+
getRandomId,
|
|
1315
|
+
getTopicFromCommand,
|
|
1316
|
+
getTopicFromMessage,
|
|
1317
|
+
sleep,
|
|
1318
|
+
toSystemValue
|
|
1306
1319
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _aptos_labs_ts_sdk from '@aptos-labs/ts-sdk';
|
|
2
|
-
import { Aptos, Account,
|
|
2
|
+
import { Aptos, Account, AccountAuthenticator, SimpleTransaction } from '@aptos-labs/ts-sdk';
|
|
3
3
|
import * as _thalalabs_surf_build_types_core from '@thalalabs/surf/build/types/core';
|
|
4
4
|
import * as _thalalabs_surf from '@thalalabs/surf';
|
|
5
5
|
import WebSocket from 'isomorphic-ws';
|
|
@@ -472,7 +472,7 @@ declare class Client {
|
|
|
472
472
|
static create(connection: Aptos, apiKey?: Account, url?: string): Promise<Client>;
|
|
473
473
|
setApiKey(apiKey: Account): void;
|
|
474
474
|
createUser(params: CreateUserParams): Promise<{
|
|
475
|
-
tx:
|
|
475
|
+
tx: _aptos_labs_ts_sdk.MultiAgentTransaction;
|
|
476
476
|
signature: AccountAuthenticator;
|
|
477
477
|
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
478
478
|
}>;
|
|
@@ -587,4 +587,10 @@ declare class TestFaucet extends Client {
|
|
|
587
587
|
getUSDCAddress(): Promise<`0x${string}`>;
|
|
588
588
|
}
|
|
589
589
|
|
|
590
|
-
|
|
590
|
+
declare const sleep: (ms: number) => Promise<unknown>;
|
|
591
|
+
declare const toSystemValue: (value: string) => string;
|
|
592
|
+
declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
593
|
+
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
594
|
+
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
595
|
+
|
|
596
|
+
export { type AddApiKeyParams, type Address, AdminEndpoints, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserDataRequest, type GetUserDataResponse, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PerpMarketData, type PerpOrderBookData, type PerpPosition, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKeyParams, type RepayBorrow, type SetAliasNameParams, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type User, UserStatus, type UtilizationCurve, type VaultInvestment, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WsCommand, type WsFill, type WsMessage, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, sleep, toSystemValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _aptos_labs_ts_sdk from '@aptos-labs/ts-sdk';
|
|
2
|
-
import { Aptos, Account,
|
|
2
|
+
import { Aptos, Account, AccountAuthenticator, SimpleTransaction } from '@aptos-labs/ts-sdk';
|
|
3
3
|
import * as _thalalabs_surf_build_types_core from '@thalalabs/surf/build/types/core';
|
|
4
4
|
import * as _thalalabs_surf from '@thalalabs/surf';
|
|
5
5
|
import WebSocket from 'isomorphic-ws';
|
|
@@ -472,7 +472,7 @@ declare class Client {
|
|
|
472
472
|
static create(connection: Aptos, apiKey?: Account, url?: string): Promise<Client>;
|
|
473
473
|
setApiKey(apiKey: Account): void;
|
|
474
474
|
createUser(params: CreateUserParams): Promise<{
|
|
475
|
-
tx:
|
|
475
|
+
tx: _aptos_labs_ts_sdk.MultiAgentTransaction;
|
|
476
476
|
signature: AccountAuthenticator;
|
|
477
477
|
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
478
478
|
}>;
|
|
@@ -587,4 +587,10 @@ declare class TestFaucet extends Client {
|
|
|
587
587
|
getUSDCAddress(): Promise<`0x${string}`>;
|
|
588
588
|
}
|
|
589
589
|
|
|
590
|
-
|
|
590
|
+
declare const sleep: (ms: number) => Promise<unknown>;
|
|
591
|
+
declare const toSystemValue: (value: string) => string;
|
|
592
|
+
declare const generateApiKey: () => _aptos_labs_ts_sdk.Ed25519Account;
|
|
593
|
+
declare const getTopicFromCommand: (data: WsCommand) => string;
|
|
594
|
+
declare const getTopicFromMessage: (data: WsMessage) => string;
|
|
595
|
+
|
|
596
|
+
export { type AddApiKeyParams, type Address, AdminEndpoints, type BalanceChange, BaseEndpoints, type Borrow, type BorrowLending, type CancelAllPerpOrdersParams, type CancelPerpOrdersParams, type CanceledPerpOrders, Client, type Content, type CreateUserParams, type Deposit, type DepositToVaultParams, EndpointsV1, type ErrorResponse, type ExchangeConfig, ExchangeProxies, type Fees, type FundingCheckpoint, type FundingRate, GLOBAL_DENOMINATOR, type GetBorrowLendingDataResponse, type GetPerpMarketsDataRequest, type GetPerpMarketsDataResponse, type GetPerpOrderBookDataRequest, type GetPerpOrderBookDataResponse, type GetPerpetualMarketsConfigResponse, type GetPriceIndexesResponse, type GetTokensConfigResponse, type GetUserDataRequest, type GetUserDataResponse, type Lend, type LendTokenParams, type MarginStep, Network, type OracleUpdate, type OracleUpdates, type Order, type OrderFills, OrderSide, OrderStatus, OrderType, type OrderbookUpdate, type PerpMarketData, type PerpOrderBookData, type PerpPosition, type PerpetualMarketConfigEntry, PerpetualMarketStatus, type PlacePerpLimitOrder, type PlacePerpLimitOrderParams, type PlacePerpMarketOrder, type PlacePerpMarketOrderParams, type PriceIndex, type RedeemTokenParams, type Referral, type RemoveApiKeyParams, type RepayBorrow, type SetAliasNameParams, type SetAutolendParams, Status, type StatusResponse, type SubmitSponsoredTransactionRequest, type SubmitSponsoredTransactionResponse, TestFaucet, type TimeResponse, type TokenConfigEntry, type Topic, type Trade, TradeRole, type TradesUpdate, type User, UserStatus, type UtilizationCurve, type VaultInvestment, type Withdraw, type WithdrawFromVaultParams, type WithdrawLend, type WsCommand, type WsFill, type WsMessage, generateApiKey, getRandomId, getTopicFromCommand, getTopicFromMessage, sleep, toSystemValue };
|
package/dist/index.js
CHANGED
|
@@ -416,6 +416,7 @@ var GLOBAL_DENOMINATOR = 1e8;
|
|
|
416
416
|
|
|
417
417
|
// src/utils.ts
|
|
418
418
|
import { Decimal } from "decimal.js";
|
|
419
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
419
420
|
var toSystemValue = (value) => {
|
|
420
421
|
return new Decimal(value).mul(new Decimal(GLOBAL_DENOMINATOR)).toString();
|
|
421
422
|
};
|
|
@@ -447,6 +448,7 @@ var getTopicFromMessage = (data) => {
|
|
|
447
448
|
case "OracleUpdates":
|
|
448
449
|
return data.type;
|
|
449
450
|
}
|
|
451
|
+
throw new Error("Invalid message type");
|
|
450
452
|
};
|
|
451
453
|
|
|
452
454
|
// src/client.ts
|
|
@@ -643,8 +645,9 @@ var Client = class _Client {
|
|
|
643
645
|
functionArguments: [params.name, params.referralId],
|
|
644
646
|
typeArguments: []
|
|
645
647
|
});
|
|
646
|
-
const tx = await this._aptos.transaction.build.
|
|
648
|
+
const tx = await this._aptos.transaction.build.multiAgent({
|
|
647
649
|
sender: params.sender,
|
|
650
|
+
secondarySignerAddresses: [apiKey.accountAddress],
|
|
648
651
|
data: payload
|
|
649
652
|
});
|
|
650
653
|
const signature = this._aptos.sign({
|
|
@@ -1250,5 +1253,10 @@ export {
|
|
|
1250
1253
|
TestFaucet,
|
|
1251
1254
|
TradeRole,
|
|
1252
1255
|
UserStatus,
|
|
1253
|
-
|
|
1256
|
+
generateApiKey,
|
|
1257
|
+
getRandomId,
|
|
1258
|
+
getTopicFromCommand,
|
|
1259
|
+
getTopicFromMessage,
|
|
1260
|
+
sleep,
|
|
1261
|
+
toSystemValue
|
|
1254
1262
|
};
|