@scallop-io/sui-scallop-sdk 2.1.3-merge-split-ve-sca-alpha.2 → 2.1.3-merge-split-ve-sca-alpha.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "2.1.3-merge-split-ve-sca-alpha.2",
3
+ "version": "2.1.3-merge-split-ve-sca-alpha.3",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -1,5 +1,9 @@
1
1
  import { Transaction } from '@mysten/sui/transactions';
2
- import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
2
+ import {
3
+ normalizeSuiAddress,
4
+ MOVE_STDLIB_ADDRESS,
5
+ SuiTxBlock as SuiKitTxBlock,
6
+ } from '@scallop-io/sui-kit';
3
7
  import { ScallopBuilder } from 'src/models';
4
8
  import {
5
9
  GenerateLoyaltyProgramNormalMethod,
@@ -18,6 +22,7 @@ const generateLoyaltyProgramNormalMethod: GenerateLoyaltyProgramNormalMethod =
18
22
  };
19
23
 
20
24
  const veScaProgramIds = {
25
+ object: builder.address.get('vesca.object'),
21
26
  protocolConfig: builder.address.get('vesca.config'),
22
27
  veScaTable: builder.address.get('vesca.table'),
23
28
  subsTable: builder.address.get('vesca.subsTable'),
@@ -39,7 +44,7 @@ const generateLoyaltyProgramNormalMethod: GenerateLoyaltyProgramNormalMethod =
39
44
  );
40
45
  },
41
46
  claimVeScaLoyaltyReward: (veScaKey) => {
42
- return builder.moveCall(
47
+ const optionVeScaKey = builder.moveCall(
43
48
  txBlock,
44
49
  `${veScaLoyaltyProgramIds.pkgId}::ve_sca_reward::redeem_reward`,
45
50
  [
@@ -50,6 +55,17 @@ const generateLoyaltyProgramNormalMethod: GenerateLoyaltyProgramNormalMethod =
50
55
  veScaProgramIds.subsTable,
51
56
  ]
52
57
  );
58
+
59
+ // Extract from option
60
+ const veScaKeyType = `${veScaProgramIds.object}::ve_sca::VeScaKey`;
61
+ const rewardVeScaKey = builder.moveCall(
62
+ txBlock,
63
+ `${normalizeSuiAddress(MOVE_STDLIB_ADDRESS)}::option::destroy_some`,
64
+ [optionVeScaKey],
65
+ [veScaKeyType]
66
+ );
67
+
68
+ return rewardVeScaKey;
53
69
  },
54
70
  };
55
71
  };
@@ -248,9 +248,14 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
248
248
  txBlock,
249
249
  }) => {
250
250
  return {
251
- lockScaQuick: async (amountOrCoin, lockPeriodInDays, autoCheck = true) => {
251
+ lockScaQuick: async (
252
+ amountOrCoin,
253
+ lockPeriodInDays,
254
+ veScaKey,
255
+ autoCheck = true
256
+ ) => {
252
257
  const sender = requireSender(txBlock);
253
- const veSca = await requireVeSca(builder, txBlock);
258
+ const veSca = await requireVeSca(builder, txBlock, veScaKey);
254
259
 
255
260
  let scaCoin: TransactionObjectArgument | SuiObjectArg | undefined =
256
261
  undefined;
@@ -308,15 +308,15 @@ export const TEST_ADDRESSES: AddressesInterface = {
308
308
  '0x574a11f8a0fbaa05b8f559cb65634e8eb20f26b1ec29e7d58de9167f3cedd0f7',
309
309
  },
310
310
  veScaLoyaltyProgram: {
311
- id: '0x7e95dc10fb96ffb2341f664926417b0fb261c9f3dc417344d2a3b11a2f5bb812',
311
+ id: '0xbee5585c16275e582ad595f0bb0c0895ea97fb3f06e7a47779c98effcf756df7',
312
312
  object:
313
- '0x7e95dc10fb96ffb2341f664926417b0fb261c9f3dc417344d2a3b11a2f5bb812',
313
+ '0xbee5585c16275e582ad595f0bb0c0895ea97fb3f06e7a47779c98effcf756df7',
314
314
  adminCap:
315
- '0x4fc52ce8aab57eaa154d9ee42e9d8ecb7add6176d19ff65ebac59bf196b12de8',
315
+ '0xcf17d2d40926226695cbf18ae11d792c74c0dc5419e8259bfa415c3c629a28a9',
316
316
  veScaRewardPool:
317
- '0x59025ec74adfcde1e0d793ff432fa0281f47fe4239aa8811430f10307292eca4',
317
+ '0x8fbcc04c1dc1e0f71c6bbec61761beb2aba07e070751b3e43eeee05ccaca97d5',
318
318
  veScaRewardTableId:
319
- '0xbfa64d2dcd45c9dee92b8c0e052954c05bd687b4e3b132ace9c1f6d6cf619eba',
319
+ '0x51a7c365d58435562a2d72de2c8b78679bc81c345222ef1d9e0fbeca1e365f14',
320
320
  },
321
321
  scoin: {
322
322
  id: '0x826a4934bee9487e558eed603cf42f30cdc4321d6f31083930791b95f903b9f9',
@@ -53,6 +53,7 @@ export type VeScaQuickMethods = {
53
53
  lockScaQuick(
54
54
  amountOrCoin?: SuiObjectArg | number,
55
55
  lockPeriodInDays?: number,
56
+ veScaKey?: SuiObjectArg,
56
57
  autoCheck?: boolean
57
58
  ): Promise<void>;
58
59
  extendLockPeriodQuick: (