@@ -3,9 +3,9 @@ import { DataSource } from "@pythnetwork/xc-admin-common";
3
3
import { WormholeContract } from "./wormhole" ;
4
4
import { PriceFeedContract , PrivateKey , TxResult } from "../base" ;
5
5
import { SuiPythClient } from "@pythnetwork/pyth-sui-js" ;
6
- import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui.js /utils" ;
7
- import { Ed25519Keypair } from "@mysten/sui.js /keypairs/ed25519" ;
8
- import { TransactionBlock } from "@mysten/sui.js /transactions" ;
6
+ import { SUI_CLOCK_OBJECT_ID } from "@mysten/sui/utils" ;
7
+ import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519" ;
8
+ import { Transaction } from "@mysten/sui/transactions" ;
9
9
import { uint8ArrayToBCS } from "@certusone/wormhole-sdk/lib/cjs/sui" ;
10
10
11
11
type ObjectId = string ;
@@ -148,7 +148,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
148
148
* @param keypair used to sign the transaction
149
149
*/
150
150
async executeMigrateInstruction ( vaa : Buffer , keypair : Ed25519Keypair ) {
151
- const tx = new TransactionBlock ( ) ;
151
+ const tx = new Transaction ( ) ;
152
152
const packageId = await this . getPythPackageId ( ) ;
153
153
const verificationReceipt = await this . getVaaVerificationReceipt (
154
154
tx ,
@@ -177,7 +177,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
177
177
vaas : Buffer [ ] ,
178
178
feedIds : string [ ]
179
179
) : Promise < TxResult > {
180
- const tx = new TransactionBlock ( ) ;
180
+ const tx = new Transaction ( ) ;
181
181
await this . client . updatePriceFeeds ( tx , vaas , feedIds ) ;
182
182
const keypair = Ed25519Keypair . fromSecretKey (
183
183
Buffer . from ( senderPrivateKey , "hex" )
@@ -189,7 +189,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
189
189
senderPrivateKey : string ,
190
190
vaas : Buffer [ ]
191
191
) : Promise < TxResult > {
192
- const tx = new TransactionBlock ( ) ;
192
+ const tx = new Transaction ( ) ;
193
193
await this . client . createPriceFeed ( tx , vaas ) ;
194
194
const keypair = Ed25519Keypair . fromSecretKey (
195
195
Buffer . from ( senderPrivateKey , "hex" )
@@ -206,7 +206,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
206
206
const keypair = Ed25519Keypair . fromSecretKey (
207
207
Buffer . from ( senderPrivateKey , "hex" )
208
208
) ;
209
- const tx = new TransactionBlock ( ) ;
209
+ const tx = new Transaction ( ) ;
210
210
const packageId = await this . getPythPackageId ( ) ;
211
211
const verificationReceipt = await this . getVaaVerificationReceipt (
212
212
tx ,
@@ -229,7 +229,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
229
229
modules : number [ ] [ ] ,
230
230
dependencies : string [ ]
231
231
) {
232
- const tx = new TransactionBlock ( ) ;
232
+ const tx = new Transaction ( ) ;
233
233
const packageId = await this . getPythPackageId ( ) ;
234
234
const verificationReceipt = await this . getVaaVerificationReceipt (
235
235
tx ,
@@ -245,7 +245,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
245
245
const [ upgradeReceipt ] = tx . upgrade ( {
246
246
modules,
247
247
dependencies,
248
- packageId : packageId ,
248
+ package : packageId ,
249
249
ticket : upgradeTicket ,
250
250
} ) ;
251
251
@@ -266,7 +266,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
266
266
* @private
267
267
*/
268
268
async getVaaVerificationReceipt (
269
- tx : TransactionBlock ,
269
+ tx : Transaction ,
270
270
packageId : string ,
271
271
vaa : Buffer
272
272
) {
@@ -276,7 +276,7 @@ export class SuiPriceFeedContract extends PriceFeedContract {
276
276
target : `${ wormholePackageId } ::vaa::parse_and_verify` ,
277
277
arguments : [
278
278
tx . object ( this . wormholeStateId ) ,
279
- tx . pure ( Array . from ( vaa ) ) ,
279
+ tx . pure . arguments ( Array . from ( vaa ) ) ,
280
280
tx . object ( SUI_CLOCK_OBJECT_ID ) ,
281
281
] ,
282
282
} ) ;
@@ -295,19 +295,16 @@ export class SuiPriceFeedContract extends PriceFeedContract {
295
295
* @param keypair
296
296
* @private
297
297
*/
298
- private async executeTransaction (
299
- tx : TransactionBlock ,
300
- keypair : Ed25519Keypair
301
- ) {
298
+ private async executeTransaction ( tx : Transaction , keypair : Ed25519Keypair ) {
302
299
const provider = this . getProvider ( ) ;
303
300
tx . setSender ( keypair . toSuiAddress ( ) ) ;
304
301
const dryRun = await provider . dryRunTransactionBlock ( {
305
302
transactionBlock : await tx . build ( { client : provider } ) ,
306
303
} ) ;
307
304
tx . setGasBudget ( BigInt ( dryRun . input . gasData . budget . toString ( ) ) * BigInt ( 2 ) ) ;
308
- return provider . signAndExecuteTransactionBlock ( {
305
+ return provider . signAndExecuteTransaction ( {
309
306
signer : keypair ,
310
- transactionBlock : tx ,
307
+ transaction : tx ,
311
308
options : {
312
309
showEffects : true ,
313
310
showEvents : true ,
@@ -489,7 +486,7 @@ export class SuiWormholeContract extends WormholeContract {
489
486
senderPrivateKey : PrivateKey ,
490
487
vaa : Buffer
491
488
) : Promise < TxResult > {
492
- const tx = new TransactionBlock ( ) ;
489
+ const tx = new Transaction ( ) ;
493
490
const coreObjectId = this . stateId ;
494
491
const corePackageId = await this . client . getWormholePackageId ( ) ;
495
492
const [ verifiedVaa ] = tx . moveCall ( {
@@ -552,19 +549,16 @@ export class SuiWormholeContract extends WormholeContract {
552
549
* @param keypair
553
550
* @private
554
551
*/
555
- private async executeTransaction (
556
- tx : TransactionBlock ,
557
- keypair : Ed25519Keypair
558
- ) {
552
+ private async executeTransaction ( tx : Transaction , keypair : Ed25519Keypair ) {
559
553
const provider = this . chain . getProvider ( ) ;
560
554
tx . setSender ( keypair . toSuiAddress ( ) ) ;
561
555
const dryRun = await provider . dryRunTransactionBlock ( {
562
556
transactionBlock : await tx . build ( { client : provider } ) ,
563
557
} ) ;
564
558
tx . setGasBudget ( BigInt ( dryRun . input . gasData . budget . toString ( ) ) * BigInt ( 2 ) ) ;
565
- return provider . signAndExecuteTransactionBlock ( {
559
+ return provider . signAndExecuteTransaction ( {
566
560
signer : keypair ,
567
- transactionBlock : tx ,
561
+ transaction : tx ,
568
562
options : {
569
563
showEffects : true ,
570
564
showEvents : true ,
0 commit comments