aftermath-ts-sdk 2.1.0-perps.4 → 2.1.0-perps.5
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.d.ts +17 -11
- package/dist/index.js +38 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -488,6 +488,7 @@ interface FaucetAddresses {
|
|
|
488
488
|
};
|
|
489
489
|
objects: {
|
|
490
490
|
faucet: ObjectId;
|
|
491
|
+
config: ObjectId;
|
|
491
492
|
suiFrensMint: ObjectId;
|
|
492
493
|
};
|
|
493
494
|
}
|
|
@@ -8537,13 +8538,10 @@ declare class Farms extends Caller {
|
|
|
8537
8538
|
|
|
8538
8539
|
declare class Faucet extends Caller {
|
|
8539
8540
|
readonly api?: AftermathApi | undefined;
|
|
8540
|
-
static readonly constants: {
|
|
8541
|
-
defaultRequestAmountUsd: number;
|
|
8542
|
-
};
|
|
8543
8541
|
constructor(config?: CallerConfig, api?: AftermathApi | undefined);
|
|
8544
8542
|
getSupportedCoins(): Promise<CoinType[]>;
|
|
8545
|
-
getRequestCoinTransaction(inputs: ApiFaucetRequestBody):
|
|
8546
|
-
getMintSuiFrenTransaction(inputs: ApiFaucetMintSuiFrenBody): Promise<
|
|
8543
|
+
getRequestCoinTransaction(inputs: ApiFaucetRequestBody): Transaction;
|
|
8544
|
+
getMintSuiFrenTransaction(inputs: ApiFaucetMintSuiFrenBody): Promise<Transaction>;
|
|
8547
8545
|
private readonly faucetApi;
|
|
8548
8546
|
}
|
|
8549
8547
|
|
|
@@ -12268,6 +12266,14 @@ declare class Perpetuals extends Caller {
|
|
|
12268
12266
|
priceBucketSize: number;
|
|
12269
12267
|
bucketsNumber: number;
|
|
12270
12268
|
}) => void;
|
|
12269
|
+
subscribeMarketCandles: ({ marketId, interval, }: {
|
|
12270
|
+
marketId: PerpetualsMarketId;
|
|
12271
|
+
interval: PerpetualsCandleResolution;
|
|
12272
|
+
}) => void;
|
|
12273
|
+
unsubscribeMarketCandles: ({ marketId, interval, }: {
|
|
12274
|
+
marketId: PerpetualsMarketId;
|
|
12275
|
+
interval: PerpetualsCandleResolution;
|
|
12276
|
+
}) => void;
|
|
12271
12277
|
close: () => void;
|
|
12272
12278
|
};
|
|
12273
12279
|
/**
|
|
@@ -16298,6 +16304,11 @@ declare class FaucetApi {
|
|
|
16298
16304
|
};
|
|
16299
16305
|
constructor(api: AftermathApi);
|
|
16300
16306
|
fetchSupportedCoins: () => Promise<CoinType[]>;
|
|
16307
|
+
/**
|
|
16308
|
+
* Mints `coinType`'s configured default amount and returns the resulting
|
|
16309
|
+
* `Coin<T>`. Use {@link buildRequestCoinTx} to mint and transfer it to a
|
|
16310
|
+
* wallet in one transaction.
|
|
16311
|
+
*/
|
|
16301
16312
|
requestCoinTx: (inputs: {
|
|
16302
16313
|
tx: Transaction;
|
|
16303
16314
|
coinType: CoinType;
|
|
@@ -16307,12 +16318,7 @@ declare class FaucetApi {
|
|
|
16307
16318
|
suiPaymentCoinId: ObjectId | TransactionArgument;
|
|
16308
16319
|
suiFrenType: AnyObjectType;
|
|
16309
16320
|
}) => _mysten_sui_transactions.TransactionResult;
|
|
16310
|
-
buildRequestCoinTx: (inputs:
|
|
16311
|
-
walletAddress: SuiAddress;
|
|
16312
|
-
} & Omit<{
|
|
16313
|
-
tx: Transaction;
|
|
16314
|
-
coinType: CoinType;
|
|
16315
|
-
}, "tx">) => Transaction;
|
|
16321
|
+
buildRequestCoinTx: (inputs: ApiFaucetRequestBody) => Transaction;
|
|
16316
16322
|
fetchBuildMintSuiFrenTx: (inputs: ApiFaucetMintSuiFrenBody) => Promise<Transaction>;
|
|
16317
16323
|
fetchMintCoinEvents: (inputs: EventsInputs) => Promise<EventsWithCursor<FaucetMintCoinEvent>>;
|
|
16318
16324
|
fetchAddCoinEvents: (inputs: EventsInputs) => Promise<EventsWithCursor<FaucetAddCoinEvent>>;
|
package/dist/index.js
CHANGED
|
@@ -5896,29 +5896,19 @@ var init_faucet = __esm({
|
|
|
5896
5896
|
// =========================================================================
|
|
5897
5897
|
// Inspections
|
|
5898
5898
|
// =========================================================================
|
|
5899
|
-
|
|
5899
|
+
getSupportedCoins() {
|
|
5900
5900
|
return this.fetchApi("supported-coins");
|
|
5901
5901
|
}
|
|
5902
5902
|
// =========================================================================
|
|
5903
|
-
// Events
|
|
5904
|
-
// =========================================================================
|
|
5905
|
-
// TODO: add mint coin event getter ?
|
|
5906
|
-
// =========================================================================
|
|
5907
5903
|
// Transactions
|
|
5908
5904
|
// =========================================================================
|
|
5909
|
-
|
|
5905
|
+
getRequestCoinTransaction(inputs) {
|
|
5910
5906
|
return this.faucetApi().buildRequestCoinTx(inputs);
|
|
5911
5907
|
}
|
|
5912
|
-
|
|
5908
|
+
getMintSuiFrenTransaction(inputs) {
|
|
5913
5909
|
return this.faucetApi().fetchBuildMintSuiFrenTx(inputs);
|
|
5914
5910
|
}
|
|
5915
5911
|
};
|
|
5916
|
-
// =========================================================================
|
|
5917
|
-
// Constants
|
|
5918
|
-
// =========================================================================
|
|
5919
|
-
Faucet.constants = {
|
|
5920
|
-
defaultRequestAmountUsd: 10
|
|
5921
|
-
};
|
|
5922
5912
|
}
|
|
5923
5913
|
});
|
|
5924
5914
|
|
|
@@ -12980,6 +12970,20 @@ var init_perpetuals = __esm({
|
|
|
12980
12970
|
}
|
|
12981
12971
|
}
|
|
12982
12972
|
});
|
|
12973
|
+
const subscribeMarketCandles = ({
|
|
12974
|
+
marketId,
|
|
12975
|
+
interval
|
|
12976
|
+
}) => ctl.send({
|
|
12977
|
+
action: "subscribe",
|
|
12978
|
+
subscriptionType: { marketCandles: { marketId, interval } }
|
|
12979
|
+
});
|
|
12980
|
+
const unsubscribeMarketCandles = ({
|
|
12981
|
+
marketId,
|
|
12982
|
+
interval
|
|
12983
|
+
}) => ctl.send({
|
|
12984
|
+
action: "unsubscribe",
|
|
12985
|
+
subscriptionType: { marketCandles: { marketId, interval } }
|
|
12986
|
+
});
|
|
12983
12987
|
return {
|
|
12984
12988
|
ws: ctl.ws,
|
|
12985
12989
|
subscribeMarket,
|
|
@@ -12998,6 +13002,8 @@ var init_perpetuals = __esm({
|
|
|
12998
13002
|
unsubscribeUserCollateralChanges,
|
|
12999
13003
|
subscribeTopOfOrderbook,
|
|
13000
13004
|
unsubscribeTopOfOrderbook,
|
|
13005
|
+
subscribeMarketCandles,
|
|
13006
|
+
unsubscribeMarketCandles,
|
|
13001
13007
|
close: ctl.close
|
|
13002
13008
|
};
|
|
13003
13009
|
}
|
|
@@ -17757,7 +17763,6 @@ var init_faucetApi = __esm({
|
|
|
17757
17763
|
"use strict";
|
|
17758
17764
|
init_eventsApiHelpers();
|
|
17759
17765
|
init_transactionsApiHelpers();
|
|
17760
|
-
init_utils();
|
|
17761
17766
|
init_coin2();
|
|
17762
17767
|
init_sui2();
|
|
17763
17768
|
init_faucetApiCasting();
|
|
@@ -17778,35 +17783,24 @@ var init_faucetApi = __esm({
|
|
|
17778
17783
|
// =========================================================================
|
|
17779
17784
|
// Transaction Commands
|
|
17780
17785
|
// =========================================================================
|
|
17781
|
-
|
|
17782
|
-
|
|
17783
|
-
|
|
17784
|
-
|
|
17785
|
-
|
|
17786
|
-
// const { tx, treasuryCapId, treasuryCapType } = inputs;
|
|
17787
|
-
// return tx.moveCall({
|
|
17788
|
-
// target: TransactionsApiHelpers.createTxTarget(
|
|
17789
|
-
// this.addresses.packages.faucet,
|
|
17790
|
-
// FaucetApi.constants.moduleNames.faucet,
|
|
17791
|
-
// "add_coin"
|
|
17792
|
-
// ),
|
|
17793
|
-
// typeArguments: [treasuryCapType],
|
|
17794
|
-
// arguments: [
|
|
17795
|
-
// tx.object(this.addresses.objects.faucet),
|
|
17796
|
-
// tx.object(treasuryCapId),
|
|
17797
|
-
// ],
|
|
17798
|
-
// });
|
|
17799
|
-
// };
|
|
17786
|
+
/**
|
|
17787
|
+
* Mints `coinType`'s configured default amount and returns the resulting
|
|
17788
|
+
* `Coin<T>`. Use {@link buildRequestCoinTx} to mint and transfer it to a
|
|
17789
|
+
* wallet in one transaction.
|
|
17790
|
+
*/
|
|
17800
17791
|
this.requestCoinTx = (inputs) => {
|
|
17801
17792
|
const { tx, coinType } = inputs;
|
|
17802
17793
|
return tx.moveCall({
|
|
17803
17794
|
target: TransactionsApiHelpers.createTxTarget(
|
|
17804
17795
|
this.addresses.packages.faucet,
|
|
17805
17796
|
_FaucetApi.constants.moduleNames.faucet,
|
|
17806
|
-
"
|
|
17797
|
+
"mint"
|
|
17807
17798
|
),
|
|
17808
17799
|
typeArguments: [coinType],
|
|
17809
|
-
arguments: [
|
|
17800
|
+
arguments: [
|
|
17801
|
+
tx.object(this.addresses.objects.faucet),
|
|
17802
|
+
tx.object(this.addresses.objects.config)
|
|
17803
|
+
]
|
|
17810
17804
|
});
|
|
17811
17805
|
};
|
|
17812
17806
|
this.mintSuiFrenTx = (inputs) => {
|
|
@@ -17831,9 +17825,14 @@ var init_faucetApi = __esm({
|
|
|
17831
17825
|
// =========================================================================
|
|
17832
17826
|
// Transaction Builders
|
|
17833
17827
|
// =========================================================================
|
|
17834
|
-
this.buildRequestCoinTx =
|
|
17835
|
-
|
|
17836
|
-
|
|
17828
|
+
this.buildRequestCoinTx = (inputs) => {
|
|
17829
|
+
const { walletAddress, coinType } = inputs;
|
|
17830
|
+
const tx = new Transaction9();
|
|
17831
|
+
tx.setSender(walletAddress);
|
|
17832
|
+
const coin = this.requestCoinTx({ tx, coinType });
|
|
17833
|
+
tx.transferObjects([coin], walletAddress);
|
|
17834
|
+
return tx;
|
|
17835
|
+
};
|
|
17837
17836
|
this.fetchBuildMintSuiFrenTx = async (inputs) => {
|
|
17838
17837
|
const { walletAddress, mintFee, suiFrenType } = inputs;
|
|
17839
17838
|
const tx = new Transaction9();
|
|
@@ -17850,7 +17849,6 @@ var init_faucetApi = __esm({
|
|
|
17850
17849
|
// =========================================================================
|
|
17851
17850
|
// Events
|
|
17852
17851
|
// =========================================================================
|
|
17853
|
-
// TODO: add to indexer
|
|
17854
17852
|
this.fetchMintCoinEvents = async (inputs) => await this.api.Events().fetchCastEventsWithCursor({
|
|
17855
17853
|
...inputs,
|
|
17856
17854
|
query: {
|
|
@@ -17858,7 +17856,6 @@ var init_faucetApi = __esm({
|
|
|
17858
17856
|
},
|
|
17859
17857
|
eventFromEventOnChain: FaucetApiCasting.faucetMintCoinEventFromOnChain
|
|
17860
17858
|
});
|
|
17861
|
-
// TODO: add to indexer
|
|
17862
17859
|
this.fetchAddCoinEvents = async (inputs) => await this.api.Events().fetchCastEventsWithCursor(
|
|
17863
17860
|
{
|
|
17864
17861
|
...inputs,
|
|
@@ -17909,7 +17906,7 @@ var init_faucetApi = __esm({
|
|
|
17909
17906
|
},
|
|
17910
17907
|
eventNames: {
|
|
17911
17908
|
mintCoin: "MintedCoin",
|
|
17912
|
-
addCoin: "
|
|
17909
|
+
addCoin: "AddedCoin"
|
|
17913
17910
|
}
|
|
17914
17911
|
};
|
|
17915
17912
|
FaucetApi = _FaucetApi;
|