@nightlylabs/dex-sdk 0.0.99 → 0.0.101
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 +43 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +43 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1056,7 +1056,30 @@ var Client = class _Client {
|
|
|
1056
1056
|
gasUnitPrice: tx.rawTransaction.gas_unit_price.toString(),
|
|
1057
1057
|
expirationTimestampSecs: tx.rawTransaction.expiration_timestamp_secs.toString(),
|
|
1058
1058
|
chainId: parseInt(tx.rawTransaction.chain_id.toString()).toString(),
|
|
1059
|
-
authenticator: Array.from(signature.bcsToBytes())
|
|
1059
|
+
authenticator: Array.from(signature.bcsToBytes()),
|
|
1060
|
+
secondarySigners: [],
|
|
1061
|
+
secondarySignersAuthenticators: []
|
|
1062
|
+
};
|
|
1063
|
+
const response = await this.sendPostJson(
|
|
1064
|
+
payload,
|
|
1065
|
+
"/v1/submit_sponsored_transaction" /* SubmitSponsoredTransactionRequest */
|
|
1066
|
+
);
|
|
1067
|
+
return response;
|
|
1068
|
+
};
|
|
1069
|
+
this.submitSponsoredMultiAgentTransaction = async (tx, signature, secondarySignersAuthenticators) => {
|
|
1070
|
+
const payload = {
|
|
1071
|
+
sender: tx.rawTransaction.sender.toString(),
|
|
1072
|
+
sequenceNumber: tx.rawTransaction.sequence_number.toString(),
|
|
1073
|
+
payload: Array.from(tx.rawTransaction.payload.bcsToBytes()),
|
|
1074
|
+
maxGasAmount: tx.rawTransaction.max_gas_amount.toString(),
|
|
1075
|
+
gasUnitPrice: tx.rawTransaction.gas_unit_price.toString(),
|
|
1076
|
+
expirationTimestampSecs: tx.rawTransaction.expiration_timestamp_secs.toString(),
|
|
1077
|
+
chainId: parseInt(tx.rawTransaction.chain_id.toString()).toString(),
|
|
1078
|
+
authenticator: Array.from(signature.bcsToBytes()),
|
|
1079
|
+
secondarySigners: tx.secondarySignerAddresses.map((s) => s.toString()),
|
|
1080
|
+
secondarySignersAuthenticators: secondarySignersAuthenticators.map(
|
|
1081
|
+
(s) => Array.from(s.bcsToBytes())
|
|
1082
|
+
)
|
|
1060
1083
|
};
|
|
1061
1084
|
const response = await this.sendPostJson(
|
|
1062
1085
|
payload,
|
|
@@ -1528,6 +1551,25 @@ var Client = class _Client {
|
|
|
1528
1551
|
apiKey
|
|
1529
1552
|
};
|
|
1530
1553
|
}
|
|
1554
|
+
async createUserPayload(params) {
|
|
1555
|
+
const apiKey = generateApiKey();
|
|
1556
|
+
const payload = await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
1557
|
+
aptosConfig: this._aptos.config,
|
|
1558
|
+
abi: parseEntryFunctionAbi({
|
|
1559
|
+
moduleAbi: createUser_default,
|
|
1560
|
+
functionName: createUser_default.name,
|
|
1561
|
+
moduleAddress: createUser_default.address,
|
|
1562
|
+
moduleName: createUser_default.name
|
|
1563
|
+
}),
|
|
1564
|
+
function: `${createUser_default.address}::${createUser_default.name}::create_user`,
|
|
1565
|
+
typeArguments: [],
|
|
1566
|
+
functionArguments: [params.name, params.referralCode]
|
|
1567
|
+
});
|
|
1568
|
+
return {
|
|
1569
|
+
payload,
|
|
1570
|
+
apiKey
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1531
1573
|
async addApiKey(params) {
|
|
1532
1574
|
return await (0, import_ts_sdk2.generateTransactionPayload)({
|
|
1533
1575
|
aptosConfig: this._aptos.config,
|
package/dist/index.d.cts
CHANGED
|
@@ -748,6 +748,8 @@ interface SubmitSponsoredTransactionRequest {
|
|
|
748
748
|
expirationTimestampSecs: string;
|
|
749
749
|
chainId: string;
|
|
750
750
|
authenticator: number[];
|
|
751
|
+
secondarySigners: string[];
|
|
752
|
+
secondarySignersAuthenticators: number[][];
|
|
751
753
|
}
|
|
752
754
|
interface SubmitSponsoredTransactionResponse {
|
|
753
755
|
txHash: string;
|
|
@@ -1262,10 +1264,15 @@ declare class Client {
|
|
|
1262
1264
|
signature: AccountAuthenticator;
|
|
1263
1265
|
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
1264
1266
|
}>;
|
|
1267
|
+
createUserPayload(params: CreateUserParams): Promise<{
|
|
1268
|
+
payload: _aptos_labs_ts_sdk.TransactionPayloadEntryFunction;
|
|
1269
|
+
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
1270
|
+
}>;
|
|
1265
1271
|
addApiKey(params: AddApiKeyParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1266
1272
|
depositTokenPayload(params: DepositTokenParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1267
1273
|
removeApiKeySigner(params: RemoveApiKeySignerParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1268
1274
|
submitSponsoredTransaction: (tx: SimpleTransaction, signature: AccountAuthenticator) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1275
|
+
submitSponsoredMultiAgentTransaction: (tx: MultiAgentTransaction, signature: AccountAuthenticator, secondarySignersAuthenticators: AccountAuthenticator[]) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1269
1276
|
createAndSubmitTransaction(aptosPayload: any): Promise<SubmitSponsoredTransactionResponse>;
|
|
1270
1277
|
removeApiKey(params: RemoveApiKeyParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1271
1278
|
setAliasName(params: SetAliasNameParams): Promise<SubmitSponsoredTransactionResponse>;
|
package/dist/index.d.ts
CHANGED
|
@@ -748,6 +748,8 @@ interface SubmitSponsoredTransactionRequest {
|
|
|
748
748
|
expirationTimestampSecs: string;
|
|
749
749
|
chainId: string;
|
|
750
750
|
authenticator: number[];
|
|
751
|
+
secondarySigners: string[];
|
|
752
|
+
secondarySignersAuthenticators: number[][];
|
|
751
753
|
}
|
|
752
754
|
interface SubmitSponsoredTransactionResponse {
|
|
753
755
|
txHash: string;
|
|
@@ -1262,10 +1264,15 @@ declare class Client {
|
|
|
1262
1264
|
signature: AccountAuthenticator;
|
|
1263
1265
|
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
1264
1266
|
}>;
|
|
1267
|
+
createUserPayload(params: CreateUserParams): Promise<{
|
|
1268
|
+
payload: _aptos_labs_ts_sdk.TransactionPayloadEntryFunction;
|
|
1269
|
+
apiKey: _aptos_labs_ts_sdk.Ed25519Account;
|
|
1270
|
+
}>;
|
|
1265
1271
|
addApiKey(params: AddApiKeyParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1266
1272
|
depositTokenPayload(params: DepositTokenParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1267
1273
|
removeApiKeySigner(params: RemoveApiKeySignerParams): Promise<_aptos_labs_ts_sdk.TransactionPayloadEntryFunction>;
|
|
1268
1274
|
submitSponsoredTransaction: (tx: SimpleTransaction, signature: AccountAuthenticator) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1275
|
+
submitSponsoredMultiAgentTransaction: (tx: MultiAgentTransaction, signature: AccountAuthenticator, secondarySignersAuthenticators: AccountAuthenticator[]) => Promise<SubmitSponsoredTransactionResponse>;
|
|
1269
1276
|
createAndSubmitTransaction(aptosPayload: any): Promise<SubmitSponsoredTransactionResponse>;
|
|
1270
1277
|
removeApiKey(params: RemoveApiKeyParams): Promise<SubmitSponsoredTransactionResponse>;
|
|
1271
1278
|
setAliasName(params: SetAliasNameParams): Promise<SubmitSponsoredTransactionResponse>;
|
package/dist/index.js
CHANGED
|
@@ -1006,7 +1006,30 @@ var Client = class _Client {
|
|
|
1006
1006
|
gasUnitPrice: tx.rawTransaction.gas_unit_price.toString(),
|
|
1007
1007
|
expirationTimestampSecs: tx.rawTransaction.expiration_timestamp_secs.toString(),
|
|
1008
1008
|
chainId: parseInt(tx.rawTransaction.chain_id.toString()).toString(),
|
|
1009
|
-
authenticator: Array.from(signature.bcsToBytes())
|
|
1009
|
+
authenticator: Array.from(signature.bcsToBytes()),
|
|
1010
|
+
secondarySigners: [],
|
|
1011
|
+
secondarySignersAuthenticators: []
|
|
1012
|
+
};
|
|
1013
|
+
const response = await this.sendPostJson(
|
|
1014
|
+
payload,
|
|
1015
|
+
"/v1/submit_sponsored_transaction" /* SubmitSponsoredTransactionRequest */
|
|
1016
|
+
);
|
|
1017
|
+
return response;
|
|
1018
|
+
};
|
|
1019
|
+
this.submitSponsoredMultiAgentTransaction = async (tx, signature, secondarySignersAuthenticators) => {
|
|
1020
|
+
const payload = {
|
|
1021
|
+
sender: tx.rawTransaction.sender.toString(),
|
|
1022
|
+
sequenceNumber: tx.rawTransaction.sequence_number.toString(),
|
|
1023
|
+
payload: Array.from(tx.rawTransaction.payload.bcsToBytes()),
|
|
1024
|
+
maxGasAmount: tx.rawTransaction.max_gas_amount.toString(),
|
|
1025
|
+
gasUnitPrice: tx.rawTransaction.gas_unit_price.toString(),
|
|
1026
|
+
expirationTimestampSecs: tx.rawTransaction.expiration_timestamp_secs.toString(),
|
|
1027
|
+
chainId: parseInt(tx.rawTransaction.chain_id.toString()).toString(),
|
|
1028
|
+
authenticator: Array.from(signature.bcsToBytes()),
|
|
1029
|
+
secondarySigners: tx.secondarySignerAddresses.map((s) => s.toString()),
|
|
1030
|
+
secondarySignersAuthenticators: secondarySignersAuthenticators.map(
|
|
1031
|
+
(s) => Array.from(s.bcsToBytes())
|
|
1032
|
+
)
|
|
1010
1033
|
};
|
|
1011
1034
|
const response = await this.sendPostJson(
|
|
1012
1035
|
payload,
|
|
@@ -1478,6 +1501,25 @@ var Client = class _Client {
|
|
|
1478
1501
|
apiKey
|
|
1479
1502
|
};
|
|
1480
1503
|
}
|
|
1504
|
+
async createUserPayload(params) {
|
|
1505
|
+
const apiKey = generateApiKey();
|
|
1506
|
+
const payload = await generateTransactionPayload({
|
|
1507
|
+
aptosConfig: this._aptos.config,
|
|
1508
|
+
abi: parseEntryFunctionAbi({
|
|
1509
|
+
moduleAbi: createUser_default,
|
|
1510
|
+
functionName: createUser_default.name,
|
|
1511
|
+
moduleAddress: createUser_default.address,
|
|
1512
|
+
moduleName: createUser_default.name
|
|
1513
|
+
}),
|
|
1514
|
+
function: `${createUser_default.address}::${createUser_default.name}::create_user`,
|
|
1515
|
+
typeArguments: [],
|
|
1516
|
+
functionArguments: [params.name, params.referralCode]
|
|
1517
|
+
});
|
|
1518
|
+
return {
|
|
1519
|
+
payload,
|
|
1520
|
+
apiKey
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1481
1523
|
async addApiKey(params) {
|
|
1482
1524
|
return await generateTransactionPayload({
|
|
1483
1525
|
aptosConfig: this._aptos.config,
|