diff --git a/README.md b/README.md index 7049d1705..13f3e560c 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,6 @@ import { CLValueUInt64, CLValueUInt512, Duration, - FixedMode, HttpHandler, InitiatorAddr, KeyAlgorithm, @@ -134,7 +133,8 @@ import { TransactionTarget, TransactionV1, TransactionV1Payload, - TransactionEntryPointEnum + TransactionEntryPointEnum, + PaymentLimitedMode } from 'casper-js-sdk'; const rpcHandler = new HttpHandler('http://:7777/rpc'); @@ -145,10 +145,11 @@ const timestamp = new Timestamp(new Date()); const paymentAmount = '20000000000000'; const pricingMode = new PricingMode(); -const fixedMode = new FixedMode(); -fixedMode.gasPriceTolerance = 1; -fixedMode.additionalComputationFactor = 0; -pricingMode.fixed = fixedMode; +const paymentLimitedMode = new PaymentLimitedMode(); +paymentLimitedMode.gasPriceTolerance = 1; +paymentLimitedMode.paymentAmount = paymentAmount; +paymentLimitedMode.standardPayment = true; +pricingMode.paymentLimited = paymentLimitedMode; const args = Args.fromMap({ target: CLValue.newCLPublicKey( diff --git a/migration-guide-v2-v5.md b/migration-guide-v2-v5.md index 60a1f5795..32f865226 100644 --- a/migration-guide-v2-v5.md +++ b/migration-guide-v2-v5.md @@ -197,10 +197,10 @@ const publicKey = privateKey.publicKey; ```typescript const args = Args.fromMap({ - target: CLValue.newCLPublicKey( - PublicKey.fromHex('') - ), - amount: CLValueUInt512.newCLUInt512('2000000000') // 2 CSPR + target: CLValue.newCLPublicKey( + PublicKey.fromHex('') + ), + amount: CLValueUInt512.newCLUInt512('2000000000') // 2 CSPR }); ``` @@ -216,7 +216,7 @@ const transactionTarget = new TransactionTarget({}); // Native target; ```typescript const entryPoint = new TransactionEntryPoint( - TransactionEntryPointEnum.Transfer + TransactionEntryPointEnum.Transfer ); ``` @@ -230,30 +230,31 @@ const scheduling = new TransactionScheduling({}); // Standard; ```typescript const pricingMode = new PricingMode(); -const fixedMode = new FixedMode(); -fixedMode.gasPriceTolerance = 2; -fixedMode.additionalComputationFactor = 0; +const paymentLimitedMode = new PaymentLimitedMode(); +paymentLimitedMode.gasPriceTolerance = 1; +paymentLimitedMode.paymentAmount = paymentAmount; +paymentLimitedMode.standardPayment = true; -pricingMode.fixed = fixedMode; +pricingMode.paymentLimited = paymentLimitedMode; ``` 5. **Create and Sign Transaction**: ```typescript const transactionPayload = TransactionV1Payload.build({ - initiatorAddr: new InitiatorAddr(publicKey), - ttl: new Duration(1800000), - args, - timestamp: new Timestamp(new Date()), - entryPoint, - scheduling, - transactionTarget, - chainName: 'casper-net-1', - pricingMode + initiatorAddr: new InitiatorAddr(publicKey), + ttl: new Duration(1800000), + args, + timestamp: new Timestamp(new Date()), + entryPoint, + scheduling, + transactionTarget, + chainName: 'casper-net-1', + pricingMode }); const transaction = TransactionV1.makeTransactionV1( - transactionPayload + transactionPayload ); await transaction.sign(privateKey); ```