@tradeport/sui-trading-sdk 0.2.0 → 0.2.2
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/SuiTradingClient.ts +2 -2
- package/src/methods/transferNfts/transferNfts.ts +4 -4
package/dist/index.mjs
CHANGED
|
@@ -5957,44 +5957,6 @@ var removeNftBids = async ({ bidIds }, context) => {
|
|
|
5957
5957
|
// src/methods/transferNfts/transferNfts.ts
|
|
5958
5958
|
import { Transaction as Transaction21 } from "@mysten/sui/transactions";
|
|
5959
5959
|
|
|
5960
|
-
// src/graphql/queries/fetchCryptoToUsdRate.ts
|
|
5961
|
-
import { gql as gql20 } from "graphql-request";
|
|
5962
|
-
var fetchCryptoToUsdRate = gql20`
|
|
5963
|
-
query fetchCryptoToUsdRate($crypto: String!) {
|
|
5964
|
-
crypto_rates(where: { crypto: { _eq: $crypto }, fiat: { _eq: "USD" } }) {
|
|
5965
|
-
crypto
|
|
5966
|
-
fiat
|
|
5967
|
-
id
|
|
5968
|
-
rate
|
|
5969
|
-
timestamp
|
|
5970
|
-
}
|
|
5971
|
-
}
|
|
5972
|
-
`;
|
|
5973
|
-
|
|
5974
|
-
// src/helpers/getSuiToUsdRate.ts
|
|
5975
|
-
var getSuiToUsdRate = async () => {
|
|
5976
|
-
try {
|
|
5977
|
-
const res = await gqlChainRequest({
|
|
5978
|
-
chain: "sui",
|
|
5979
|
-
query: fetchCryptoToUsdRate,
|
|
5980
|
-
variables: { crypto: "sui" }
|
|
5981
|
-
});
|
|
5982
|
-
return res?.crypto_rates?.[0]?.rate;
|
|
5983
|
-
} catch (e) {
|
|
5984
|
-
}
|
|
5985
|
-
};
|
|
5986
|
-
|
|
5987
|
-
// src/helpers/addOneDollarFee.ts
|
|
5988
|
-
var addOneDollarFee = async (tx) => {
|
|
5989
|
-
const rate = await getSuiToUsdRate();
|
|
5990
|
-
const companyFee = BigInt(Math.ceil(1e9 / rate));
|
|
5991
|
-
const [microTxFee] = tx.splitCoins(tx.gas, [tx.pure.u64(Number(companyFee))]);
|
|
5992
|
-
tx.transferObjects(
|
|
5993
|
-
[tx.object(microTxFee)],
|
|
5994
|
-
tx.pure.address(addLeadingZerosAfter0x(TRADEPORT_BENEFICIARY_ADDRESS))
|
|
5995
|
-
);
|
|
5996
|
-
};
|
|
5997
|
-
|
|
5998
5960
|
// src/helpers/rpc/getAcountBalance.ts
|
|
5999
5961
|
var getAccountBalance = async ({ suiClient, owner }) => {
|
|
6000
5962
|
try {
|
|
@@ -6080,9 +6042,6 @@ var transferNfts = async ({ nftIds, recipientAddress, walletAddress }, context)
|
|
|
6080
6042
|
recipientAddress
|
|
6081
6043
|
});
|
|
6082
6044
|
}
|
|
6083
|
-
if (res?.nfts?.length > 1) {
|
|
6084
|
-
await addOneDollarFee(tx);
|
|
6085
|
-
}
|
|
6086
6045
|
return Transaction21.from(tx);
|
|
6087
6046
|
};
|
|
6088
6047
|
|
|
@@ -6236,7 +6195,7 @@ async function withdrawProfitsFromKiosks({ walletAddress }, context) {
|
|
|
6236
6195
|
// src/SuiTradingClient.ts
|
|
6237
6196
|
var SuiTradingClient = class {
|
|
6238
6197
|
constructor({ apiUser, apiKey, suiNodeUrl, graphQLClient }) {
|
|
6239
|
-
this.allowedApiUsersForUnsharedKiosksMigration = ["tradeport.xyz"];
|
|
6198
|
+
this.allowedApiUsersForUnsharedKiosksMigration = ["tradeport.xyz", "mercato.xyz"];
|
|
6240
6199
|
this.apiUser = apiUser;
|
|
6241
6200
|
this.apiKey = apiKey;
|
|
6242
6201
|
this.suiClient = createSuiClient_default(suiNodeUrl || getFullnodeUrl("mainnet"));
|