@scallop-io/sui-scallop-sdk 0.46.48 → 0.46.49
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.js +9 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/models/scallopClient.ts +6 -3
- package/src/queries/priceQuery.ts +3 -22
- package/dist/test.d.ts +0 -1
- package/src/test.ts +0 -19
package/package.json
CHANGED
|
@@ -742,12 +742,12 @@ export class ScallopClient {
|
|
|
742
742
|
const sender = walletAddress || this.walletAddress;
|
|
743
743
|
txBlock.setSender(sender);
|
|
744
744
|
|
|
745
|
-
const
|
|
745
|
+
const sCoin = await txBlock.unstakeQuick(
|
|
746
746
|
amount,
|
|
747
747
|
stakeMarketCoinName,
|
|
748
748
|
stakeAccountId
|
|
749
749
|
);
|
|
750
|
-
txBlock.transferObjects([
|
|
750
|
+
txBlock.transferObjects([sCoin], sender);
|
|
751
751
|
|
|
752
752
|
if (sign) {
|
|
753
753
|
return (await this.suiKit.signAndSendTxn(
|
|
@@ -793,13 +793,16 @@ export class ScallopClient {
|
|
|
793
793
|
const stakeMarketCoin = await txBlock.unstakeQuick(
|
|
794
794
|
amount,
|
|
795
795
|
stakeMarketCoinName,
|
|
796
|
-
stakeAccountId
|
|
796
|
+
stakeAccountId,
|
|
797
|
+
false
|
|
797
798
|
);
|
|
798
799
|
const stakeCoinName =
|
|
799
800
|
this.utils.parseCoinName<SupportStakeCoins>(stakeMarketCoinName);
|
|
800
801
|
if (stakeMarketCoin) {
|
|
801
802
|
const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
|
|
802
803
|
txBlock.transferObjects([coin], sender);
|
|
804
|
+
} else {
|
|
805
|
+
throw new Error(`No stake found for ${stakeMarketCoinName}`);
|
|
803
806
|
}
|
|
804
807
|
|
|
805
808
|
if (sign) {
|
|
@@ -61,30 +61,11 @@ export const getPythPrices = async (
|
|
|
61
61
|
query: ScallopQuery,
|
|
62
62
|
assetCoinNames: SupportAssetCoins[]
|
|
63
63
|
) => {
|
|
64
|
-
const seen: Record<string, boolean> = {};
|
|
65
|
-
const pythFeedObjectIds = assetCoinNames
|
|
66
|
-
.map((assetCoinName) => {
|
|
67
|
-
const pythFeedObjectId = query.address.get(
|
|
68
|
-
`core.coins.${assetCoinName}.oracle.pyth.feedObject`
|
|
69
|
-
);
|
|
70
|
-
if (seen[pythFeedObjectId]) return null;
|
|
71
|
-
|
|
72
|
-
seen[pythFeedObjectId] = true;
|
|
73
|
-
return pythFeedObjectId;
|
|
74
|
-
})
|
|
75
|
-
.filter((item) => !!item) as string[];
|
|
76
|
-
const priceFeedObjects = await query.cache.queryGetObjects(
|
|
77
|
-
pythFeedObjectIds,
|
|
78
|
-
{
|
|
79
|
-
showContent: true,
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
|
|
83
64
|
return (
|
|
84
65
|
await Promise.all(
|
|
85
|
-
|
|
86
|
-
coinName:
|
|
87
|
-
price: await getPythPrice(query,
|
|
66
|
+
assetCoinNames.map(async (assetCoinName) => ({
|
|
67
|
+
coinName: assetCoinName,
|
|
68
|
+
price: await getPythPrice(query, assetCoinName),
|
|
88
69
|
}))
|
|
89
70
|
)
|
|
90
71
|
).reduce(
|
package/dist/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/src/test.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Scallop } from './models';
|
|
2
|
-
import * as dotenv from 'dotenv';
|
|
3
|
-
dotenv.config();
|
|
4
|
-
const scallop = new Scallop({
|
|
5
|
-
secretKey: process.env.SECRET_KEY as string,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
const main = async () => {
|
|
9
|
-
const query = await scallop.createScallopQuery();
|
|
10
|
-
|
|
11
|
-
const res = await query.getVeScas(
|
|
12
|
-
'0xd1a70cfe7332e994a950b9c570e93def4b6d2ec53b34ff5c0cc9946226a7cf3d'
|
|
13
|
-
);
|
|
14
|
-
console.dir(res, { depth: null });
|
|
15
|
-
};
|
|
16
|
-
main()
|
|
17
|
-
.then()
|
|
18
|
-
.catch(console.error)
|
|
19
|
-
.finally(() => process.exit(0));
|