From bd19369de352942570f6020b925f8f2db07627c9 Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Tue, 24 Oct 2023 09:42:59 +0800 Subject: [PATCH 1/5] update xdr --- Makefile | 2 +- .../xdr/BumpFootprintExpirationResult.java | 131 ------- .../stellar/sdk/xdr/ConfigSettingEntry.java | 34 +- .../org/stellar/sdk/xdr/ConfigSettingID.java | 6 +- .../org/stellar/sdk/xdr/ContractCostType.java | 165 ++++----- .../stellar/sdk/xdr/ContractExecutable.java | 6 +- .../sdk/xdr/ContractExecutableType.java | 6 +- ...ationOp.java => ExtendFootprintTTLOp.java} | 59 ++- .../sdk/xdr/ExtendFootprintTTLResult.java | 128 +++++++ ...java => ExtendFootprintTTLResultCode.java} | 39 +- .../sdk/xdr/InvokeHostFunctionResult.java | 6 +- .../sdk/xdr/InvokeHostFunctionResultCode.java | 6 +- .../org/stellar/sdk/xdr/LedgerCloseMeta.java | 28 +- .../stellar/sdk/xdr/LedgerCloseMetaV1.java | 125 ++++++- .../stellar/sdk/xdr/LedgerCloseMetaV2.java | 345 ------------------ .../java/org/stellar/sdk/xdr/LedgerEntry.java | 34 +- .../org/stellar/sdk/xdr/LedgerEntryType.java | 6 +- .../java/org/stellar/sdk/xdr/LedgerKey.java | 65 ++-- .../java/org/stellar/sdk/xdr/Operation.java | 35 +- .../org/stellar/sdk/xdr/OperationResult.java | 39 +- .../org/stellar/sdk/xdr/OperationType.java | 6 +- .../sdk/xdr/SorobanTransactionData.java | 38 +- ...ttings.java => StateArchivalSettings.java} | 160 ++++---- .../sdk/xdr/StoredDebugTransactionSet.java | 146 ++++++++ .../{ExpirationEntry.java => TTLEntry.java} | 60 +-- .../sdk/scval/ScvContractInstanceTest.java | 2 +- xdr/Stellar-contract-config-setting.x | 80 ++-- xdr/Stellar-contract.x | 4 +- xdr/Stellar-internal.x | 7 + xdr/Stellar-ledger-entries.x | 18 +- xdr/Stellar-ledger.x | 28 +- xdr/Stellar-transaction.x | 58 +-- 32 files changed, 863 insertions(+), 1009 deletions(-) delete mode 100644 src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResult.java rename src/main/java/org/stellar/sdk/xdr/{BumpFootprintExpirationOp.java => ExtendFootprintTTLOp.java} (53%) create mode 100644 src/main/java/org/stellar/sdk/xdr/ExtendFootprintTTLResult.java rename src/main/java/org/stellar/sdk/xdr/{BumpFootprintExpirationResultCode.java => ExtendFootprintTTLResultCode.java} (60%) delete mode 100644 src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV2.java rename src/main/java/org/stellar/sdk/xdr/{StateExpirationSettings.java => StateArchivalSettings.java} (53%) create mode 100644 src/main/java/org/stellar/sdk/xdr/StoredDebugTransactionSet.java rename src/main/java/org/stellar/sdk/xdr/{ExpirationEntry.java => TTLEntry.java} (54%) diff --git a/Makefile b/Makefile index be7096a09..6513e491e 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ xdr/Stellar-internal.x \ xdr/Stellar-contract-config-setting.x XDRGEN_COMMIT=7c9349c62844e376bc637be678695387e88d125f -XDRNEXT_COMMIT=9ac02641139e6717924fdad716f6e958d0168491 +XDRNEXT_COMMIT=6a620d160aab22609c982d54578ff6a63bfcdc01 .PHONY: xdr xdr-clean xdr-update diff --git a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResult.java b/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResult.java deleted file mode 100644 index c060f8baf..000000000 --- a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResult.java +++ /dev/null @@ -1,131 +0,0 @@ -// Automatically generated by xdrgen -// DO NOT EDIT or your changes may be overwritten - -package org.stellar.sdk.xdr; - -import static org.stellar.sdk.xdr.Constants.*; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.Objects; -import org.stellar.sdk.Base64Factory; - -// === xdr source ============================================================ - -// union BumpFootprintExpirationResult switch (BumpFootprintExpirationResultCode code) -// { -// case BUMP_FOOTPRINT_EXPIRATION_SUCCESS: -// void; -// case BUMP_FOOTPRINT_EXPIRATION_MALFORMED: -// case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED: -// case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE: -// void; -// }; - -// =========================================================================== -public class BumpFootprintExpirationResult implements XdrElement { - public BumpFootprintExpirationResult() {} - - BumpFootprintExpirationResultCode code; - - public BumpFootprintExpirationResultCode getDiscriminant() { - return this.code; - } - - public void setDiscriminant(BumpFootprintExpirationResultCode value) { - this.code = value; - } - - public static final class Builder { - private BumpFootprintExpirationResultCode discriminant; - - public Builder discriminant(BumpFootprintExpirationResultCode discriminant) { - this.discriminant = discriminant; - return this; - } - - public BumpFootprintExpirationResult build() { - BumpFootprintExpirationResult val = new BumpFootprintExpirationResult(); - val.setDiscriminant(discriminant); - return val; - } - } - - public static void encode( - XdrDataOutputStream stream, - BumpFootprintExpirationResult encodedBumpFootprintExpirationResult) - throws IOException { - // Xdrgen::AST::Identifier - // BumpFootprintExpirationResultCode - stream.writeInt(encodedBumpFootprintExpirationResult.getDiscriminant().getValue()); - switch (encodedBumpFootprintExpirationResult.getDiscriminant()) { - case BUMP_FOOTPRINT_EXPIRATION_SUCCESS: - break; - case BUMP_FOOTPRINT_EXPIRATION_MALFORMED: - case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED: - case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE: - break; - } - } - - public void encode(XdrDataOutputStream stream) throws IOException { - encode(stream, this); - } - - public static BumpFootprintExpirationResult decode(XdrDataInputStream stream) throws IOException { - BumpFootprintExpirationResult decodedBumpFootprintExpirationResult = - new BumpFootprintExpirationResult(); - BumpFootprintExpirationResultCode discriminant = - BumpFootprintExpirationResultCode.decode(stream); - decodedBumpFootprintExpirationResult.setDiscriminant(discriminant); - switch (decodedBumpFootprintExpirationResult.getDiscriminant()) { - case BUMP_FOOTPRINT_EXPIRATION_SUCCESS: - break; - case BUMP_FOOTPRINT_EXPIRATION_MALFORMED: - case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED: - case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE: - break; - } - return decodedBumpFootprintExpirationResult; - } - - @Override - public int hashCode() { - return Objects.hash(this.code); - } - - @Override - public boolean equals(Object object) { - if (!(object instanceof BumpFootprintExpirationResult)) { - return false; - } - - BumpFootprintExpirationResult other = (BumpFootprintExpirationResult) object; - return Objects.equals(this.code, other.code); - } - - @Override - public String toXdrBase64() throws IOException { - return Base64Factory.getInstance().encodeToString(toXdrByteArray()); - } - - @Override - public byte[] toXdrByteArray() throws IOException { - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - XdrDataOutputStream xdrDataOutputStream = new XdrDataOutputStream(byteArrayOutputStream); - encode(xdrDataOutputStream); - return byteArrayOutputStream.toByteArray(); - } - - public static BumpFootprintExpirationResult fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64Factory.getInstance().decode(xdr); - return fromXdrByteArray(bytes); - } - - public static BumpFootprintExpirationResult fromXdrByteArray(byte[] xdr) throws IOException { - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); - XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); - return decode(xdrDataInputStream); - } -} diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigSettingEntry.java b/src/main/java/org/stellar/sdk/xdr/ConfigSettingEntry.java index 102ad435c..0b1c8aa6e 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigSettingEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigSettingEntry.java @@ -36,8 +36,8 @@ // uint32 contractDataKeySizeBytes; // case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: // uint32 contractDataEntrySizeBytes; -// case CONFIG_SETTING_STATE_EXPIRATION: -// StateExpirationSettings stateExpirationSettings; +// case CONFIG_SETTING_STATE_ARCHIVAL: +// StateArchivalSettings stateArchivalSettings; // case CONFIG_SETTING_CONTRACT_EXECUTION_LANES: // ConfigSettingContractExecutionLanesV0 contractExecutionLanes; // case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: @@ -160,14 +160,14 @@ public void setContractDataEntrySizeBytes(Uint32 value) { this.contractDataEntrySizeBytes = value; } - private StateExpirationSettings stateExpirationSettings; + private StateArchivalSettings stateArchivalSettings; - public StateExpirationSettings getStateExpirationSettings() { - return this.stateExpirationSettings; + public StateArchivalSettings getStateArchivalSettings() { + return this.stateArchivalSettings; } - public void setStateExpirationSettings(StateExpirationSettings value) { - this.stateExpirationSettings = value; + public void setStateArchivalSettings(StateArchivalSettings value) { + this.stateArchivalSettings = value; } private ConfigSettingContractExecutionLanesV0 contractExecutionLanes; @@ -212,7 +212,7 @@ public static final class Builder { private ContractCostParams contractCostParamsMemBytes; private Uint32 contractDataKeySizeBytes; private Uint32 contractDataEntrySizeBytes; - private StateExpirationSettings stateExpirationSettings; + private StateArchivalSettings stateArchivalSettings; private ConfigSettingContractExecutionLanesV0 contractExecutionLanes; private Uint64[] bucketListSizeWindow; private EvictionIterator evictionIterator; @@ -273,8 +273,8 @@ public Builder contractDataEntrySizeBytes(Uint32 contractDataEntrySizeBytes) { return this; } - public Builder stateExpirationSettings(StateExpirationSettings stateExpirationSettings) { - this.stateExpirationSettings = stateExpirationSettings; + public Builder stateArchivalSettings(StateArchivalSettings stateArchivalSettings) { + this.stateArchivalSettings = stateArchivalSettings; return this; } @@ -307,7 +307,7 @@ public ConfigSettingEntry build() { val.setContractCostParamsMemBytes(this.contractCostParamsMemBytes); val.setContractDataKeySizeBytes(this.contractDataKeySizeBytes); val.setContractDataEntrySizeBytes(this.contractDataEntrySizeBytes); - val.setStateExpirationSettings(this.stateExpirationSettings); + val.setStateArchivalSettings(this.stateArchivalSettings); val.setContractExecutionLanes(this.contractExecutionLanes); val.setBucketListSizeWindow(this.bucketListSizeWindow); val.setEvictionIterator(this.evictionIterator); @@ -354,8 +354,8 @@ public static void encode( case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: Uint32.encode(stream, encodedConfigSettingEntry.contractDataEntrySizeBytes); break; - case CONFIG_SETTING_STATE_EXPIRATION: - StateExpirationSettings.encode(stream, encodedConfigSettingEntry.stateExpirationSettings); + case CONFIG_SETTING_STATE_ARCHIVAL: + StateArchivalSettings.encode(stream, encodedConfigSettingEntry.stateArchivalSettings); break; case CONFIG_SETTING_CONTRACT_EXECUTION_LANES: ConfigSettingContractExecutionLanesV0.encode( @@ -416,8 +416,8 @@ public static ConfigSettingEntry decode(XdrDataInputStream stream) throws IOExce case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: decodedConfigSettingEntry.contractDataEntrySizeBytes = Uint32.decode(stream); break; - case CONFIG_SETTING_STATE_EXPIRATION: - decodedConfigSettingEntry.stateExpirationSettings = StateExpirationSettings.decode(stream); + case CONFIG_SETTING_STATE_ARCHIVAL: + decodedConfigSettingEntry.stateArchivalSettings = StateArchivalSettings.decode(stream); break; case CONFIG_SETTING_CONTRACT_EXECUTION_LANES: decodedConfigSettingEntry.contractExecutionLanes = @@ -450,7 +450,7 @@ public int hashCode() { this.contractCostParamsMemBytes, this.contractDataKeySizeBytes, this.contractDataEntrySizeBytes, - this.stateExpirationSettings, + this.stateArchivalSettings, this.contractExecutionLanes, Arrays.hashCode(this.bucketListSizeWindow), this.evictionIterator, @@ -474,7 +474,7 @@ public boolean equals(Object object) { && Objects.equals(this.contractCostParamsMemBytes, other.contractCostParamsMemBytes) && Objects.equals(this.contractDataKeySizeBytes, other.contractDataKeySizeBytes) && Objects.equals(this.contractDataEntrySizeBytes, other.contractDataEntrySizeBytes) - && Objects.equals(this.stateExpirationSettings, other.stateExpirationSettings) + && Objects.equals(this.stateArchivalSettings, other.stateArchivalSettings) && Objects.equals(this.contractExecutionLanes, other.contractExecutionLanes) && Arrays.equals(this.bucketListSizeWindow, other.bucketListSizeWindow) && Objects.equals(this.evictionIterator, other.evictionIterator) diff --git a/src/main/java/org/stellar/sdk/xdr/ConfigSettingID.java b/src/main/java/org/stellar/sdk/xdr/ConfigSettingID.java index ec1afab94..cf07afd3b 100644 --- a/src/main/java/org/stellar/sdk/xdr/ConfigSettingID.java +++ b/src/main/java/org/stellar/sdk/xdr/ConfigSettingID.java @@ -24,7 +24,7 @@ // CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7, // CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8, // CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9, -// CONFIG_SETTING_STATE_EXPIRATION = 10, +// CONFIG_SETTING_STATE_ARCHIVAL = 10, // CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11, // CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12, // CONFIG_SETTING_EVICTION_ITERATOR = 13 @@ -42,7 +42,7 @@ public enum ConfigSettingID implements XdrElement { CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES(7), CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES(8), CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES(9), - CONFIG_SETTING_STATE_EXPIRATION(10), + CONFIG_SETTING_STATE_ARCHIVAL(10), CONFIG_SETTING_CONTRACT_EXECUTION_LANES(11), CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW(12), CONFIG_SETTING_EVICTION_ITERATOR(13), @@ -81,7 +81,7 @@ public static ConfigSettingID decode(XdrDataInputStream stream) throws IOExcepti case 9: return CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES; case 10: - return CONFIG_SETTING_STATE_EXPIRATION; + return CONFIG_SETTING_STATE_ARCHIVAL; case 11: return CONFIG_SETTING_CONTRACT_EXECUTION_LANES; case 12: diff --git a/src/main/java/org/stellar/sdk/xdr/ContractCostType.java b/src/main/java/org/stellar/sdk/xdr/ContractCostType.java index 69631667b..b00448083 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractCostType.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractCostType.java @@ -15,96 +15,81 @@ // enum ContractCostType { // // Cost of running 1 wasm instruction // WasmInsnExec = 0, -// // Cost of growing wasm linear memory by 1 page -// WasmMemAlloc = 1, -// // Cost of allocating a chuck of host memory (in bytes) -// HostMemAlloc = 2, -// // Cost of copying a chuck of bytes into a pre-allocated host memory -// HostMemCpy = 3, -// // Cost of comparing two slices of host memory -// HostMemCmp = 4, +// // Cost of allocating a slice of memory (in bytes) +// MemAlloc = 1, +// // Cost of copying a slice of bytes into a pre-allocated memory +// MemCpy = 2, +// // Cost of comparing two slices of memory +// MemCmp = 3, // // Cost of a host function dispatch, not including the actual work done by // // the function nor the cost of VM invocation machinary -// DispatchHostFunction = 5, +// DispatchHostFunction = 4, // // Cost of visiting a host object from the host object storage. Exists to // // make sure some baseline cost coverage, i.e. repeatly visiting objects // // by the guest will always incur some charges. -// VisitObject = 6, +// VisitObject = 5, // // Cost of serializing an xdr object to bytes -// ValSer = 7, +// ValSer = 6, // // Cost of deserializing an xdr object from bytes -// ValDeser = 8, +// ValDeser = 7, // // Cost of computing the sha256 hash from bytes -// ComputeSha256Hash = 9, +// ComputeSha256Hash = 8, // // Cost of computing the ed25519 pubkey from bytes -// ComputeEd25519PubKey = 10, -// // Cost of accessing an entry in a Map. -// MapEntry = 11, -// // Cost of accessing an entry in a Vec -// VecEntry = 12, +// ComputeEd25519PubKey = 9, // // Cost of verifying ed25519 signature of a payload. -// VerifyEd25519Sig = 13, -// // Cost of reading a slice of vm linear memory -// VmMemRead = 14, -// // Cost of writing to a slice of vm linear memory -// VmMemWrite = 15, +// VerifyEd25519Sig = 10, // // Cost of instantiation a VM from wasm bytes code. -// VmInstantiation = 16, +// VmInstantiation = 11, // // Cost of instantiation a VM from a cached state. -// VmCachedInstantiation = 17, +// VmCachedInstantiation = 12, // // Cost of invoking a function on the VM. If the function is a host function, // // additional cost will be covered by `DispatchHostFunction`. -// InvokeVmFunction = 18, +// InvokeVmFunction = 13, // // Cost of computing a keccak256 hash from bytes. -// ComputeKeccak256Hash = 19, -// // Cost of computing an ECDSA secp256k1 pubkey from bytes. -// ComputeEcdsaSecp256k1Key = 20, +// ComputeKeccak256Hash = 14, // // Cost of computing an ECDSA secp256k1 signature from bytes. -// ComputeEcdsaSecp256k1Sig = 21, +// ComputeEcdsaSecp256k1Sig = 15, // // Cost of recovering an ECDSA secp256k1 key from a signature. -// RecoverEcdsaSecp256k1Key = 22, +// RecoverEcdsaSecp256k1Key = 16, // // Cost of int256 addition (`+`) and subtraction (`-`) operations -// Int256AddSub = 23, +// Int256AddSub = 17, // // Cost of int256 multiplication (`*`) operation -// Int256Mul = 24, +// Int256Mul = 18, // // Cost of int256 division (`/`) operation -// Int256Div = 25, +// Int256Div = 19, // // Cost of int256 power (`exp`) operation -// Int256Pow = 26, +// Int256Pow = 20, // // Cost of int256 shift (`shl`, `shr`) operation -// Int256Shift = 27 +// Int256Shift = 21, +// // Cost of drawing random bytes using a ChaCha20 PRNG +// ChaCha20DrawBytes = 22 // }; // =========================================================================== public enum ContractCostType implements XdrElement { WasmInsnExec(0), - WasmMemAlloc(1), - HostMemAlloc(2), - HostMemCpy(3), - HostMemCmp(4), - DispatchHostFunction(5), - VisitObject(6), - ValSer(7), - ValDeser(8), - ComputeSha256Hash(9), - ComputeEd25519PubKey(10), - MapEntry(11), - VecEntry(12), - VerifyEd25519Sig(13), - VmMemRead(14), - VmMemWrite(15), - VmInstantiation(16), - VmCachedInstantiation(17), - InvokeVmFunction(18), - ComputeKeccak256Hash(19), - ComputeEcdsaSecp256k1Key(20), - ComputeEcdsaSecp256k1Sig(21), - RecoverEcdsaSecp256k1Key(22), - Int256AddSub(23), - Int256Mul(24), - Int256Div(25), - Int256Pow(26), - Int256Shift(27), + MemAlloc(1), + MemCpy(2), + MemCmp(3), + DispatchHostFunction(4), + VisitObject(5), + ValSer(6), + ValDeser(7), + ComputeSha256Hash(8), + ComputeEd25519PubKey(9), + VerifyEd25519Sig(10), + VmInstantiation(11), + VmCachedInstantiation(12), + InvokeVmFunction(13), + ComputeKeccak256Hash(14), + ComputeEcdsaSecp256k1Sig(15), + RecoverEcdsaSecp256k1Key(16), + Int256AddSub(17), + Int256Mul(18), + Int256Div(19), + Int256Pow(20), + Int256Shift(21), + ChaCha20DrawBytes(22), ; private int mValue; @@ -122,59 +107,49 @@ public static ContractCostType decode(XdrDataInputStream stream) throws IOExcept case 0: return WasmInsnExec; case 1: - return WasmMemAlloc; + return MemAlloc; case 2: - return HostMemAlloc; + return MemCpy; case 3: - return HostMemCpy; + return MemCmp; case 4: - return HostMemCmp; - case 5: return DispatchHostFunction; - case 6: + case 5: return VisitObject; - case 7: + case 6: return ValSer; - case 8: + case 7: return ValDeser; - case 9: + case 8: return ComputeSha256Hash; - case 10: + case 9: return ComputeEd25519PubKey; - case 11: - return MapEntry; - case 12: - return VecEntry; - case 13: + case 10: return VerifyEd25519Sig; - case 14: - return VmMemRead; - case 15: - return VmMemWrite; - case 16: + case 11: return VmInstantiation; - case 17: + case 12: return VmCachedInstantiation; - case 18: + case 13: return InvokeVmFunction; - case 19: + case 14: return ComputeKeccak256Hash; - case 20: - return ComputeEcdsaSecp256k1Key; - case 21: + case 15: return ComputeEcdsaSecp256k1Sig; - case 22: + case 16: return RecoverEcdsaSecp256k1Key; - case 23: + case 17: return Int256AddSub; - case 24: + case 18: return Int256Mul; - case 25: + case 19: return Int256Div; - case 26: + case 20: return Int256Pow; - case 27: + case 21: return Int256Shift; + case 22: + return ChaCha20DrawBytes; default: throw new RuntimeException("Unknown enum value: " + value); } diff --git a/src/main/java/org/stellar/sdk/xdr/ContractExecutable.java b/src/main/java/org/stellar/sdk/xdr/ContractExecutable.java index 4120bd844..811226017 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractExecutable.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractExecutable.java @@ -17,7 +17,7 @@ // { // case CONTRACT_EXECUTABLE_WASM: // Hash wasm_hash; -// case CONTRACT_EXECUTABLE_TOKEN: +// case CONTRACT_EXECUTABLE_STELLAR_ASSET: // void; // }; @@ -76,7 +76,7 @@ public static void encode( case CONTRACT_EXECUTABLE_WASM: Hash.encode(stream, encodedContractExecutable.wasm_hash); break; - case CONTRACT_EXECUTABLE_TOKEN: + case CONTRACT_EXECUTABLE_STELLAR_ASSET: break; } } @@ -93,7 +93,7 @@ public static ContractExecutable decode(XdrDataInputStream stream) throws IOExce case CONTRACT_EXECUTABLE_WASM: decodedContractExecutable.wasm_hash = Hash.decode(stream); break; - case CONTRACT_EXECUTABLE_TOKEN: + case CONTRACT_EXECUTABLE_STELLAR_ASSET: break; } return decodedContractExecutable; diff --git a/src/main/java/org/stellar/sdk/xdr/ContractExecutableType.java b/src/main/java/org/stellar/sdk/xdr/ContractExecutableType.java index f84376601..8bcc4d773 100644 --- a/src/main/java/org/stellar/sdk/xdr/ContractExecutableType.java +++ b/src/main/java/org/stellar/sdk/xdr/ContractExecutableType.java @@ -15,13 +15,13 @@ // enum ContractExecutableType // { // CONTRACT_EXECUTABLE_WASM = 0, -// CONTRACT_EXECUTABLE_TOKEN = 1 +// CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 // }; // =========================================================================== public enum ContractExecutableType implements XdrElement { CONTRACT_EXECUTABLE_WASM(0), - CONTRACT_EXECUTABLE_TOKEN(1), + CONTRACT_EXECUTABLE_STELLAR_ASSET(1), ; private int mValue; @@ -39,7 +39,7 @@ public static ContractExecutableType decode(XdrDataInputStream stream) throws IO case 0: return CONTRACT_EXECUTABLE_WASM; case 1: - return CONTRACT_EXECUTABLE_TOKEN; + return CONTRACT_EXECUTABLE_STELLAR_ASSET; default: throw new RuntimeException("Unknown enum value: " + value); } diff --git a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationOp.java b/src/main/java/org/stellar/sdk/xdr/ExtendFootprintTTLOp.java similarity index 53% rename from src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationOp.java rename to src/main/java/org/stellar/sdk/xdr/ExtendFootprintTTLOp.java index de76ffe54..3e7fe6a0b 100644 --- a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationOp.java +++ b/src/main/java/org/stellar/sdk/xdr/ExtendFootprintTTLOp.java @@ -13,15 +13,15 @@ // === xdr source ============================================================ -// struct BumpFootprintExpirationOp +// struct ExtendFootprintTTLOp // { // ExtensionPoint ext; -// uint32 ledgersToExpire; +// uint32 extendTo; // }; // =========================================================================== -public class BumpFootprintExpirationOp implements XdrElement { - public BumpFootprintExpirationOp() {} +public class ExtendFootprintTTLOp implements XdrElement { + public ExtendFootprintTTLOp() {} private ExtensionPoint ext; @@ -33,48 +33,47 @@ public void setExt(ExtensionPoint value) { this.ext = value; } - private Uint32 ledgersToExpire; + private Uint32 extendTo; - public Uint32 getLedgersToExpire() { - return this.ledgersToExpire; + public Uint32 getExtendTo() { + return this.extendTo; } - public void setLedgersToExpire(Uint32 value) { - this.ledgersToExpire = value; + public void setExtendTo(Uint32 value) { + this.extendTo = value; } public static void encode( - XdrDataOutputStream stream, BumpFootprintExpirationOp encodedBumpFootprintExpirationOp) + XdrDataOutputStream stream, ExtendFootprintTTLOp encodedExtendFootprintTTLOp) throws IOException { - ExtensionPoint.encode(stream, encodedBumpFootprintExpirationOp.ext); - Uint32.encode(stream, encodedBumpFootprintExpirationOp.ledgersToExpire); + ExtensionPoint.encode(stream, encodedExtendFootprintTTLOp.ext); + Uint32.encode(stream, encodedExtendFootprintTTLOp.extendTo); } public void encode(XdrDataOutputStream stream) throws IOException { encode(stream, this); } - public static BumpFootprintExpirationOp decode(XdrDataInputStream stream) throws IOException { - BumpFootprintExpirationOp decodedBumpFootprintExpirationOp = new BumpFootprintExpirationOp(); - decodedBumpFootprintExpirationOp.ext = ExtensionPoint.decode(stream); - decodedBumpFootprintExpirationOp.ledgersToExpire = Uint32.decode(stream); - return decodedBumpFootprintExpirationOp; + public static ExtendFootprintTTLOp decode(XdrDataInputStream stream) throws IOException { + ExtendFootprintTTLOp decodedExtendFootprintTTLOp = new ExtendFootprintTTLOp(); + decodedExtendFootprintTTLOp.ext = ExtensionPoint.decode(stream); + decodedExtendFootprintTTLOp.extendTo = Uint32.decode(stream); + return decodedExtendFootprintTTLOp; } @Override public int hashCode() { - return Objects.hash(this.ext, this.ledgersToExpire); + return Objects.hash(this.ext, this.extendTo); } @Override public boolean equals(Object object) { - if (!(object instanceof BumpFootprintExpirationOp)) { + if (!(object instanceof ExtendFootprintTTLOp)) { return false; } - BumpFootprintExpirationOp other = (BumpFootprintExpirationOp) object; - return Objects.equals(this.ext, other.ext) - && Objects.equals(this.ledgersToExpire, other.ledgersToExpire); + ExtendFootprintTTLOp other = (ExtendFootprintTTLOp) object; + return Objects.equals(this.ext, other.ext) && Objects.equals(this.extendTo, other.extendTo); } @Override @@ -90,12 +89,12 @@ public byte[] toXdrByteArray() throws IOException { return byteArrayOutputStream.toByteArray(); } - public static BumpFootprintExpirationOp fromXdrBase64(String xdr) throws IOException { + public static ExtendFootprintTTLOp fromXdrBase64(String xdr) throws IOException { byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } - public static BumpFootprintExpirationOp fromXdrByteArray(byte[] xdr) throws IOException { + public static ExtendFootprintTTLOp fromXdrByteArray(byte[] xdr) throws IOException { ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); return decode(xdrDataInputStream); @@ -103,22 +102,22 @@ public static BumpFootprintExpirationOp fromXdrByteArray(byte[] xdr) throws IOEx public static final class Builder { private ExtensionPoint ext; - private Uint32 ledgersToExpire; + private Uint32 extendTo; public Builder ext(ExtensionPoint ext) { this.ext = ext; return this; } - public Builder ledgersToExpire(Uint32 ledgersToExpire) { - this.ledgersToExpire = ledgersToExpire; + public Builder extendTo(Uint32 extendTo) { + this.extendTo = extendTo; return this; } - public BumpFootprintExpirationOp build() { - BumpFootprintExpirationOp val = new BumpFootprintExpirationOp(); + public ExtendFootprintTTLOp build() { + ExtendFootprintTTLOp val = new ExtendFootprintTTLOp(); val.setExt(this.ext); - val.setLedgersToExpire(this.ledgersToExpire); + val.setExtendTo(this.extendTo); return val; } } diff --git a/src/main/java/org/stellar/sdk/xdr/ExtendFootprintTTLResult.java b/src/main/java/org/stellar/sdk/xdr/ExtendFootprintTTLResult.java new file mode 100644 index 000000000..ce939cc48 --- /dev/null +++ b/src/main/java/org/stellar/sdk/xdr/ExtendFootprintTTLResult.java @@ -0,0 +1,128 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +package org.stellar.sdk.xdr; + +import static org.stellar.sdk.xdr.Constants.*; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Objects; +import org.stellar.sdk.Base64Factory; + +// === xdr source ============================================================ + +// union ExtendFootprintTTLResult switch (ExtendFootprintTTLResultCode code) +// { +// case EXTEND_FOOTPRINT_TTL_SUCCESS: +// void; +// case EXTEND_FOOTPRINT_TTL_MALFORMED: +// case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: +// case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: +// void; +// }; + +// =========================================================================== +public class ExtendFootprintTTLResult implements XdrElement { + public ExtendFootprintTTLResult() {} + + ExtendFootprintTTLResultCode code; + + public ExtendFootprintTTLResultCode getDiscriminant() { + return this.code; + } + + public void setDiscriminant(ExtendFootprintTTLResultCode value) { + this.code = value; + } + + public static final class Builder { + private ExtendFootprintTTLResultCode discriminant; + + public Builder discriminant(ExtendFootprintTTLResultCode discriminant) { + this.discriminant = discriminant; + return this; + } + + public ExtendFootprintTTLResult build() { + ExtendFootprintTTLResult val = new ExtendFootprintTTLResult(); + val.setDiscriminant(discriminant); + return val; + } + } + + public static void encode( + XdrDataOutputStream stream, ExtendFootprintTTLResult encodedExtendFootprintTTLResult) + throws IOException { + // Xdrgen::AST::Identifier + // ExtendFootprintTTLResultCode + stream.writeInt(encodedExtendFootprintTTLResult.getDiscriminant().getValue()); + switch (encodedExtendFootprintTTLResult.getDiscriminant()) { + case EXTEND_FOOTPRINT_TTL_SUCCESS: + break; + case EXTEND_FOOTPRINT_TTL_MALFORMED: + case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: + case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: + break; + } + } + + public void encode(XdrDataOutputStream stream) throws IOException { + encode(stream, this); + } + + public static ExtendFootprintTTLResult decode(XdrDataInputStream stream) throws IOException { + ExtendFootprintTTLResult decodedExtendFootprintTTLResult = new ExtendFootprintTTLResult(); + ExtendFootprintTTLResultCode discriminant = ExtendFootprintTTLResultCode.decode(stream); + decodedExtendFootprintTTLResult.setDiscriminant(discriminant); + switch (decodedExtendFootprintTTLResult.getDiscriminant()) { + case EXTEND_FOOTPRINT_TTL_SUCCESS: + break; + case EXTEND_FOOTPRINT_TTL_MALFORMED: + case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: + case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: + break; + } + return decodedExtendFootprintTTLResult; + } + + @Override + public int hashCode() { + return Objects.hash(this.code); + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof ExtendFootprintTTLResult)) { + return false; + } + + ExtendFootprintTTLResult other = (ExtendFootprintTTLResult) object; + return Objects.equals(this.code, other.code); + } + + @Override + public String toXdrBase64() throws IOException { + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); + } + + @Override + public byte[] toXdrByteArray() throws IOException { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + XdrDataOutputStream xdrDataOutputStream = new XdrDataOutputStream(byteArrayOutputStream); + encode(xdrDataOutputStream); + return byteArrayOutputStream.toByteArray(); + } + + public static ExtendFootprintTTLResult fromXdrBase64(String xdr) throws IOException { + byte[] bytes = Base64Factory.getInstance().decode(xdr); + return fromXdrByteArray(bytes); + } + + public static ExtendFootprintTTLResult fromXdrByteArray(byte[] xdr) throws IOException { + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); + XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); + return decode(xdrDataInputStream); + } +} diff --git a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResultCode.java b/src/main/java/org/stellar/sdk/xdr/ExtendFootprintTTLResultCode.java similarity index 60% rename from src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResultCode.java rename to src/main/java/org/stellar/sdk/xdr/ExtendFootprintTTLResultCode.java index d51f65ef0..f1b5d71f1 100644 --- a/src/main/java/org/stellar/sdk/xdr/BumpFootprintExpirationResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/ExtendFootprintTTLResultCode.java @@ -12,27 +12,27 @@ // === xdr source ============================================================ -// enum BumpFootprintExpirationResultCode +// enum ExtendFootprintTTLResultCode // { // // codes considered as "success" for the operation -// BUMP_FOOTPRINT_EXPIRATION_SUCCESS = 0, +// EXTEND_FOOTPRINT_TTL_SUCCESS = 0, // // // codes considered as "failure" for the operation -// BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1, -// BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2, -// BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3 +// EXTEND_FOOTPRINT_TTL_MALFORMED = -1, +// EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2, +// EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3 // }; // =========================================================================== -public enum BumpFootprintExpirationResultCode implements XdrElement { - BUMP_FOOTPRINT_EXPIRATION_SUCCESS(0), - BUMP_FOOTPRINT_EXPIRATION_MALFORMED(-1), - BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED(-2), - BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE(-3), +public enum ExtendFootprintTTLResultCode implements XdrElement { + EXTEND_FOOTPRINT_TTL_SUCCESS(0), + EXTEND_FOOTPRINT_TTL_MALFORMED(-1), + EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED(-2), + EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE(-3), ; private int mValue; - BumpFootprintExpirationResultCode(int value) { + ExtendFootprintTTLResultCode(int value) { mValue = value; } @@ -40,24 +40,23 @@ public int getValue() { return mValue; } - public static BumpFootprintExpirationResultCode decode(XdrDataInputStream stream) - throws IOException { + public static ExtendFootprintTTLResultCode decode(XdrDataInputStream stream) throws IOException { int value = stream.readInt(); switch (value) { case 0: - return BUMP_FOOTPRINT_EXPIRATION_SUCCESS; + return EXTEND_FOOTPRINT_TTL_SUCCESS; case -1: - return BUMP_FOOTPRINT_EXPIRATION_MALFORMED; + return EXTEND_FOOTPRINT_TTL_MALFORMED; case -2: - return BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED; + return EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED; case -3: - return BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE; + return EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE; default: throw new RuntimeException("Unknown enum value: " + value); } } - public static void encode(XdrDataOutputStream stream, BumpFootprintExpirationResultCode value) + public static void encode(XdrDataOutputStream stream, ExtendFootprintTTLResultCode value) throws IOException { stream.writeInt(value.getValue()); } @@ -79,12 +78,12 @@ public byte[] toXdrByteArray() throws IOException { return byteArrayOutputStream.toByteArray(); } - public static BumpFootprintExpirationResultCode fromXdrBase64(String xdr) throws IOException { + public static ExtendFootprintTTLResultCode fromXdrBase64(String xdr) throws IOException { byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } - public static BumpFootprintExpirationResultCode fromXdrByteArray(byte[] xdr) throws IOException { + public static ExtendFootprintTTLResultCode fromXdrByteArray(byte[] xdr) throws IOException { ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); return decode(xdrDataInputStream); diff --git a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResult.java b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResult.java index b9d3df511..81e85193d 100644 --- a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResult.java +++ b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResult.java @@ -20,7 +20,7 @@ // case INVOKE_HOST_FUNCTION_MALFORMED: // case INVOKE_HOST_FUNCTION_TRAPPED: // case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: -// case INVOKE_HOST_FUNCTION_ENTRY_EXPIRED: +// case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: // case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: // void; // }; @@ -84,7 +84,7 @@ public static void encode( case INVOKE_HOST_FUNCTION_MALFORMED: case INVOKE_HOST_FUNCTION_TRAPPED: case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: - case INVOKE_HOST_FUNCTION_ENTRY_EXPIRED: + case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: break; } @@ -105,7 +105,7 @@ public static InvokeHostFunctionResult decode(XdrDataInputStream stream) throws case INVOKE_HOST_FUNCTION_MALFORMED: case INVOKE_HOST_FUNCTION_TRAPPED: case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: - case INVOKE_HOST_FUNCTION_ENTRY_EXPIRED: + case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: break; } diff --git a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResultCode.java b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResultCode.java index 0ad3336ea..653d89986 100644 --- a/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResultCode.java +++ b/src/main/java/org/stellar/sdk/xdr/InvokeHostFunctionResultCode.java @@ -21,7 +21,7 @@ // INVOKE_HOST_FUNCTION_MALFORMED = -1, // INVOKE_HOST_FUNCTION_TRAPPED = -2, // INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3, -// INVOKE_HOST_FUNCTION_ENTRY_EXPIRED = -4, +// INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4, // INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5 // }; @@ -31,7 +31,7 @@ public enum InvokeHostFunctionResultCode implements XdrElement { INVOKE_HOST_FUNCTION_MALFORMED(-1), INVOKE_HOST_FUNCTION_TRAPPED(-2), INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED(-3), - INVOKE_HOST_FUNCTION_ENTRY_EXPIRED(-4), + INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED(-4), INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE(-5), ; private int mValue; @@ -56,7 +56,7 @@ public static InvokeHostFunctionResultCode decode(XdrDataInputStream stream) thr case -3: return INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED; case -4: - return INVOKE_HOST_FUNCTION_ENTRY_EXPIRED; + return INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED; case -5: return INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE; default: diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMeta.java b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMeta.java index 99a0a160b..8aebc2ca5 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMeta.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMeta.java @@ -19,8 +19,6 @@ // LedgerCloseMetaV0 v0; // case 1: // LedgerCloseMetaV1 v1; -// case 2: -// LedgerCloseMetaV2 v2; // }; // =========================================================================== @@ -57,21 +55,10 @@ public void setV1(LedgerCloseMetaV1 value) { this.v1 = value; } - private LedgerCloseMetaV2 v2; - - public LedgerCloseMetaV2 getV2() { - return this.v2; - } - - public void setV2(LedgerCloseMetaV2 value) { - this.v2 = value; - } - public static final class Builder { private Integer discriminant; private LedgerCloseMetaV0 v0; private LedgerCloseMetaV1 v1; - private LedgerCloseMetaV2 v2; public Builder discriminant(Integer discriminant) { this.discriminant = discriminant; @@ -88,17 +75,11 @@ public Builder v1(LedgerCloseMetaV1 v1) { return this; } - public Builder v2(LedgerCloseMetaV2 v2) { - this.v2 = v2; - return this; - } - public LedgerCloseMeta build() { LedgerCloseMeta val = new LedgerCloseMeta(); val.setDiscriminant(discriminant); val.setV0(this.v0); val.setV1(this.v1); - val.setV2(this.v2); return val; } } @@ -115,9 +96,6 @@ public static void encode(XdrDataOutputStream stream, LedgerCloseMeta encodedLed case 1: LedgerCloseMetaV1.encode(stream, encodedLedgerCloseMeta.v1); break; - case 2: - LedgerCloseMetaV2.encode(stream, encodedLedgerCloseMeta.v2); - break; } } @@ -136,16 +114,13 @@ public static LedgerCloseMeta decode(XdrDataInputStream stream) throws IOExcepti case 1: decodedLedgerCloseMeta.v1 = LedgerCloseMetaV1.decode(stream); break; - case 2: - decodedLedgerCloseMeta.v2 = LedgerCloseMetaV2.decode(stream); - break; } return decodedLedgerCloseMeta; } @Override public int hashCode() { - return Objects.hash(this.v0, this.v1, this.v2, this.v); + return Objects.hash(this.v0, this.v1, this.v); } @Override @@ -157,7 +132,6 @@ public boolean equals(Object object) { LedgerCloseMeta other = (LedgerCloseMeta) object; return Objects.equals(this.v0, other.v0) && Objects.equals(this.v1, other.v1) - && Objects.equals(this.v2, other.v2) && Objects.equals(this.v, other.v); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV1.java b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV1.java index 484a78de2..c960b8ef4 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV1.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV1.java @@ -16,6 +16,10 @@ // struct LedgerCloseMetaV1 // { +// // We forgot to add an ExtensionPoint in v0 but at least +// // we can add one now in v1. +// ExtensionPoint ext; +// // LedgerHeaderHistoryEntry ledgerHeader; // // GeneralizedTransactionSet txSet; @@ -30,12 +34,33 @@ // // // other misc information attached to the ledger close // SCPHistoryEntry scpInfo<>; +// +// // Size in bytes of BucketList, to support downstream +// // systems calculating storage fees correctly. +// uint64 totalByteSizeOfBucketList; +// +// // Temp keys that are being evicted at this ledger. +// LedgerKey evictedTemporaryLedgerKeys<>; +// +// // Archived restorable ledger entries that are being +// // evicted at this ledger. +// LedgerEntry evictedPersistentLedgerEntries<>; // }; // =========================================================================== public class LedgerCloseMetaV1 implements XdrElement { public LedgerCloseMetaV1() {} + private ExtensionPoint ext; + + public ExtensionPoint getExt() { + return this.ext; + } + + public void setExt(ExtensionPoint value) { + this.ext = value; + } + private LedgerHeaderHistoryEntry ledgerHeader; public LedgerHeaderHistoryEntry getLedgerHeader() { @@ -86,8 +111,39 @@ public void setScpInfo(SCPHistoryEntry[] value) { this.scpInfo = value; } + private Uint64 totalByteSizeOfBucketList; + + public Uint64 getTotalByteSizeOfBucketList() { + return this.totalByteSizeOfBucketList; + } + + public void setTotalByteSizeOfBucketList(Uint64 value) { + this.totalByteSizeOfBucketList = value; + } + + private LedgerKey[] evictedTemporaryLedgerKeys; + + public LedgerKey[] getEvictedTemporaryLedgerKeys() { + return this.evictedTemporaryLedgerKeys; + } + + public void setEvictedTemporaryLedgerKeys(LedgerKey[] value) { + this.evictedTemporaryLedgerKeys = value; + } + + private LedgerEntry[] evictedPersistentLedgerEntries; + + public LedgerEntry[] getEvictedPersistentLedgerEntries() { + return this.evictedPersistentLedgerEntries; + } + + public void setEvictedPersistentLedgerEntries(LedgerEntry[] value) { + this.evictedPersistentLedgerEntries = value; + } + public static void encode(XdrDataOutputStream stream, LedgerCloseMetaV1 encodedLedgerCloseMetaV1) throws IOException { + ExtensionPoint.encode(stream, encodedLedgerCloseMetaV1.ext); LedgerHeaderHistoryEntry.encode(stream, encodedLedgerCloseMetaV1.ledgerHeader); GeneralizedTransactionSet.encode(stream, encodedLedgerCloseMetaV1.txSet); int txProcessingsize = encodedLedgerCloseMetaV1.getTxProcessing().length; @@ -105,6 +161,19 @@ public static void encode(XdrDataOutputStream stream, LedgerCloseMetaV1 encodedL for (int i = 0; i < scpInfosize; i++) { SCPHistoryEntry.encode(stream, encodedLedgerCloseMetaV1.scpInfo[i]); } + Uint64.encode(stream, encodedLedgerCloseMetaV1.totalByteSizeOfBucketList); + int evictedTemporaryLedgerKeyssize = + encodedLedgerCloseMetaV1.getEvictedTemporaryLedgerKeys().length; + stream.writeInt(evictedTemporaryLedgerKeyssize); + for (int i = 0; i < evictedTemporaryLedgerKeyssize; i++) { + LedgerKey.encode(stream, encodedLedgerCloseMetaV1.evictedTemporaryLedgerKeys[i]); + } + int evictedPersistentLedgerEntriessize = + encodedLedgerCloseMetaV1.getEvictedPersistentLedgerEntries().length; + stream.writeInt(evictedPersistentLedgerEntriessize); + for (int i = 0; i < evictedPersistentLedgerEntriessize; i++) { + LedgerEntry.encode(stream, encodedLedgerCloseMetaV1.evictedPersistentLedgerEntries[i]); + } } public void encode(XdrDataOutputStream stream) throws IOException { @@ -113,6 +182,7 @@ public void encode(XdrDataOutputStream stream) throws IOException { public static LedgerCloseMetaV1 decode(XdrDataInputStream stream) throws IOException { LedgerCloseMetaV1 decodedLedgerCloseMetaV1 = new LedgerCloseMetaV1(); + decodedLedgerCloseMetaV1.ext = ExtensionPoint.decode(stream); decodedLedgerCloseMetaV1.ledgerHeader = LedgerHeaderHistoryEntry.decode(stream); decodedLedgerCloseMetaV1.txSet = GeneralizedTransactionSet.decode(stream); int txProcessingsize = stream.readInt(); @@ -130,17 +200,34 @@ public static LedgerCloseMetaV1 decode(XdrDataInputStream stream) throws IOExcep for (int i = 0; i < scpInfosize; i++) { decodedLedgerCloseMetaV1.scpInfo[i] = SCPHistoryEntry.decode(stream); } + decodedLedgerCloseMetaV1.totalByteSizeOfBucketList = Uint64.decode(stream); + int evictedTemporaryLedgerKeyssize = stream.readInt(); + decodedLedgerCloseMetaV1.evictedTemporaryLedgerKeys = + new LedgerKey[evictedTemporaryLedgerKeyssize]; + for (int i = 0; i < evictedTemporaryLedgerKeyssize; i++) { + decodedLedgerCloseMetaV1.evictedTemporaryLedgerKeys[i] = LedgerKey.decode(stream); + } + int evictedPersistentLedgerEntriessize = stream.readInt(); + decodedLedgerCloseMetaV1.evictedPersistentLedgerEntries = + new LedgerEntry[evictedPersistentLedgerEntriessize]; + for (int i = 0; i < evictedPersistentLedgerEntriessize; i++) { + decodedLedgerCloseMetaV1.evictedPersistentLedgerEntries[i] = LedgerEntry.decode(stream); + } return decodedLedgerCloseMetaV1; } @Override public int hashCode() { return Objects.hash( + this.ext, this.ledgerHeader, this.txSet, Arrays.hashCode(this.txProcessing), Arrays.hashCode(this.upgradesProcessing), - Arrays.hashCode(this.scpInfo)); + Arrays.hashCode(this.scpInfo), + this.totalByteSizeOfBucketList, + Arrays.hashCode(this.evictedTemporaryLedgerKeys), + Arrays.hashCode(this.evictedPersistentLedgerEntries)); } @Override @@ -150,11 +237,15 @@ public boolean equals(Object object) { } LedgerCloseMetaV1 other = (LedgerCloseMetaV1) object; - return Objects.equals(this.ledgerHeader, other.ledgerHeader) + return Objects.equals(this.ext, other.ext) + && Objects.equals(this.ledgerHeader, other.ledgerHeader) && Objects.equals(this.txSet, other.txSet) && Arrays.equals(this.txProcessing, other.txProcessing) && Arrays.equals(this.upgradesProcessing, other.upgradesProcessing) - && Arrays.equals(this.scpInfo, other.scpInfo); + && Arrays.equals(this.scpInfo, other.scpInfo) + && Objects.equals(this.totalByteSizeOfBucketList, other.totalByteSizeOfBucketList) + && Arrays.equals(this.evictedTemporaryLedgerKeys, other.evictedTemporaryLedgerKeys) + && Arrays.equals(this.evictedPersistentLedgerEntries, other.evictedPersistentLedgerEntries); } @Override @@ -182,11 +273,20 @@ public static LedgerCloseMetaV1 fromXdrByteArray(byte[] xdr) throws IOException } public static final class Builder { + private ExtensionPoint ext; private LedgerHeaderHistoryEntry ledgerHeader; private GeneralizedTransactionSet txSet; private TransactionResultMeta[] txProcessing; private UpgradeEntryMeta[] upgradesProcessing; private SCPHistoryEntry[] scpInfo; + private Uint64 totalByteSizeOfBucketList; + private LedgerKey[] evictedTemporaryLedgerKeys; + private LedgerEntry[] evictedPersistentLedgerEntries; + + public Builder ext(ExtensionPoint ext) { + this.ext = ext; + return this; + } public Builder ledgerHeader(LedgerHeaderHistoryEntry ledgerHeader) { this.ledgerHeader = ledgerHeader; @@ -213,13 +313,32 @@ public Builder scpInfo(SCPHistoryEntry[] scpInfo) { return this; } + public Builder totalByteSizeOfBucketList(Uint64 totalByteSizeOfBucketList) { + this.totalByteSizeOfBucketList = totalByteSizeOfBucketList; + return this; + } + + public Builder evictedTemporaryLedgerKeys(LedgerKey[] evictedTemporaryLedgerKeys) { + this.evictedTemporaryLedgerKeys = evictedTemporaryLedgerKeys; + return this; + } + + public Builder evictedPersistentLedgerEntries(LedgerEntry[] evictedPersistentLedgerEntries) { + this.evictedPersistentLedgerEntries = evictedPersistentLedgerEntries; + return this; + } + public LedgerCloseMetaV1 build() { LedgerCloseMetaV1 val = new LedgerCloseMetaV1(); + val.setExt(this.ext); val.setLedgerHeader(this.ledgerHeader); val.setTxSet(this.txSet); val.setTxProcessing(this.txProcessing); val.setUpgradesProcessing(this.upgradesProcessing); val.setScpInfo(this.scpInfo); + val.setTotalByteSizeOfBucketList(this.totalByteSizeOfBucketList); + val.setEvictedTemporaryLedgerKeys(this.evictedTemporaryLedgerKeys); + val.setEvictedPersistentLedgerEntries(this.evictedPersistentLedgerEntries); return val; } } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV2.java b/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV2.java deleted file mode 100644 index ddb7556f8..000000000 --- a/src/main/java/org/stellar/sdk/xdr/LedgerCloseMetaV2.java +++ /dev/null @@ -1,345 +0,0 @@ -// Automatically generated by xdrgen -// DO NOT EDIT or your changes may be overwritten - -package org.stellar.sdk.xdr; - -import static org.stellar.sdk.xdr.Constants.*; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.Arrays; -import java.util.Objects; -import org.stellar.sdk.Base64Factory; - -// === xdr source ============================================================ - -// struct LedgerCloseMetaV2 -// { -// // We forgot to add an ExtensionPoint in v1 but at least -// // we can add one now in v2. -// ExtensionPoint ext; -// -// LedgerHeaderHistoryEntry ledgerHeader; -// -// GeneralizedTransactionSet txSet; -// -// // NB: transactions are sorted in apply order here -// // fees for all transactions are processed first -// // followed by applying transactions -// TransactionResultMeta txProcessing<>; -// -// // upgrades are applied last -// UpgradeEntryMeta upgradesProcessing<>; -// -// // other misc information attached to the ledger close -// SCPHistoryEntry scpInfo<>; -// -// // Size in bytes of BucketList, to support downstream -// // systems calculating storage fees correctly. -// uint64 totalByteSizeOfBucketList; -// -// // Expired temp keys that are being evicted at this ledger. -// LedgerKey evictedTemporaryLedgerKeys<>; -// -// // Expired restorable ledger entries that are being -// // evicted at this ledger. -// LedgerEntry evictedPersistentLedgerEntries<>; -// }; - -// =========================================================================== -public class LedgerCloseMetaV2 implements XdrElement { - public LedgerCloseMetaV2() {} - - private ExtensionPoint ext; - - public ExtensionPoint getExt() { - return this.ext; - } - - public void setExt(ExtensionPoint value) { - this.ext = value; - } - - private LedgerHeaderHistoryEntry ledgerHeader; - - public LedgerHeaderHistoryEntry getLedgerHeader() { - return this.ledgerHeader; - } - - public void setLedgerHeader(LedgerHeaderHistoryEntry value) { - this.ledgerHeader = value; - } - - private GeneralizedTransactionSet txSet; - - public GeneralizedTransactionSet getTxSet() { - return this.txSet; - } - - public void setTxSet(GeneralizedTransactionSet value) { - this.txSet = value; - } - - private TransactionResultMeta[] txProcessing; - - public TransactionResultMeta[] getTxProcessing() { - return this.txProcessing; - } - - public void setTxProcessing(TransactionResultMeta[] value) { - this.txProcessing = value; - } - - private UpgradeEntryMeta[] upgradesProcessing; - - public UpgradeEntryMeta[] getUpgradesProcessing() { - return this.upgradesProcessing; - } - - public void setUpgradesProcessing(UpgradeEntryMeta[] value) { - this.upgradesProcessing = value; - } - - private SCPHistoryEntry[] scpInfo; - - public SCPHistoryEntry[] getScpInfo() { - return this.scpInfo; - } - - public void setScpInfo(SCPHistoryEntry[] value) { - this.scpInfo = value; - } - - private Uint64 totalByteSizeOfBucketList; - - public Uint64 getTotalByteSizeOfBucketList() { - return this.totalByteSizeOfBucketList; - } - - public void setTotalByteSizeOfBucketList(Uint64 value) { - this.totalByteSizeOfBucketList = value; - } - - private LedgerKey[] evictedTemporaryLedgerKeys; - - public LedgerKey[] getEvictedTemporaryLedgerKeys() { - return this.evictedTemporaryLedgerKeys; - } - - public void setEvictedTemporaryLedgerKeys(LedgerKey[] value) { - this.evictedTemporaryLedgerKeys = value; - } - - private LedgerEntry[] evictedPersistentLedgerEntries; - - public LedgerEntry[] getEvictedPersistentLedgerEntries() { - return this.evictedPersistentLedgerEntries; - } - - public void setEvictedPersistentLedgerEntries(LedgerEntry[] value) { - this.evictedPersistentLedgerEntries = value; - } - - public static void encode(XdrDataOutputStream stream, LedgerCloseMetaV2 encodedLedgerCloseMetaV2) - throws IOException { - ExtensionPoint.encode(stream, encodedLedgerCloseMetaV2.ext); - LedgerHeaderHistoryEntry.encode(stream, encodedLedgerCloseMetaV2.ledgerHeader); - GeneralizedTransactionSet.encode(stream, encodedLedgerCloseMetaV2.txSet); - int txProcessingsize = encodedLedgerCloseMetaV2.getTxProcessing().length; - stream.writeInt(txProcessingsize); - for (int i = 0; i < txProcessingsize; i++) { - TransactionResultMeta.encode(stream, encodedLedgerCloseMetaV2.txProcessing[i]); - } - int upgradesProcessingsize = encodedLedgerCloseMetaV2.getUpgradesProcessing().length; - stream.writeInt(upgradesProcessingsize); - for (int i = 0; i < upgradesProcessingsize; i++) { - UpgradeEntryMeta.encode(stream, encodedLedgerCloseMetaV2.upgradesProcessing[i]); - } - int scpInfosize = encodedLedgerCloseMetaV2.getScpInfo().length; - stream.writeInt(scpInfosize); - for (int i = 0; i < scpInfosize; i++) { - SCPHistoryEntry.encode(stream, encodedLedgerCloseMetaV2.scpInfo[i]); - } - Uint64.encode(stream, encodedLedgerCloseMetaV2.totalByteSizeOfBucketList); - int evictedTemporaryLedgerKeyssize = - encodedLedgerCloseMetaV2.getEvictedTemporaryLedgerKeys().length; - stream.writeInt(evictedTemporaryLedgerKeyssize); - for (int i = 0; i < evictedTemporaryLedgerKeyssize; i++) { - LedgerKey.encode(stream, encodedLedgerCloseMetaV2.evictedTemporaryLedgerKeys[i]); - } - int evictedPersistentLedgerEntriessize = - encodedLedgerCloseMetaV2.getEvictedPersistentLedgerEntries().length; - stream.writeInt(evictedPersistentLedgerEntriessize); - for (int i = 0; i < evictedPersistentLedgerEntriessize; i++) { - LedgerEntry.encode(stream, encodedLedgerCloseMetaV2.evictedPersistentLedgerEntries[i]); - } - } - - public void encode(XdrDataOutputStream stream) throws IOException { - encode(stream, this); - } - - public static LedgerCloseMetaV2 decode(XdrDataInputStream stream) throws IOException { - LedgerCloseMetaV2 decodedLedgerCloseMetaV2 = new LedgerCloseMetaV2(); - decodedLedgerCloseMetaV2.ext = ExtensionPoint.decode(stream); - decodedLedgerCloseMetaV2.ledgerHeader = LedgerHeaderHistoryEntry.decode(stream); - decodedLedgerCloseMetaV2.txSet = GeneralizedTransactionSet.decode(stream); - int txProcessingsize = stream.readInt(); - decodedLedgerCloseMetaV2.txProcessing = new TransactionResultMeta[txProcessingsize]; - for (int i = 0; i < txProcessingsize; i++) { - decodedLedgerCloseMetaV2.txProcessing[i] = TransactionResultMeta.decode(stream); - } - int upgradesProcessingsize = stream.readInt(); - decodedLedgerCloseMetaV2.upgradesProcessing = new UpgradeEntryMeta[upgradesProcessingsize]; - for (int i = 0; i < upgradesProcessingsize; i++) { - decodedLedgerCloseMetaV2.upgradesProcessing[i] = UpgradeEntryMeta.decode(stream); - } - int scpInfosize = stream.readInt(); - decodedLedgerCloseMetaV2.scpInfo = new SCPHistoryEntry[scpInfosize]; - for (int i = 0; i < scpInfosize; i++) { - decodedLedgerCloseMetaV2.scpInfo[i] = SCPHistoryEntry.decode(stream); - } - decodedLedgerCloseMetaV2.totalByteSizeOfBucketList = Uint64.decode(stream); - int evictedTemporaryLedgerKeyssize = stream.readInt(); - decodedLedgerCloseMetaV2.evictedTemporaryLedgerKeys = - new LedgerKey[evictedTemporaryLedgerKeyssize]; - for (int i = 0; i < evictedTemporaryLedgerKeyssize; i++) { - decodedLedgerCloseMetaV2.evictedTemporaryLedgerKeys[i] = LedgerKey.decode(stream); - } - int evictedPersistentLedgerEntriessize = stream.readInt(); - decodedLedgerCloseMetaV2.evictedPersistentLedgerEntries = - new LedgerEntry[evictedPersistentLedgerEntriessize]; - for (int i = 0; i < evictedPersistentLedgerEntriessize; i++) { - decodedLedgerCloseMetaV2.evictedPersistentLedgerEntries[i] = LedgerEntry.decode(stream); - } - return decodedLedgerCloseMetaV2; - } - - @Override - public int hashCode() { - return Objects.hash( - this.ext, - this.ledgerHeader, - this.txSet, - Arrays.hashCode(this.txProcessing), - Arrays.hashCode(this.upgradesProcessing), - Arrays.hashCode(this.scpInfo), - this.totalByteSizeOfBucketList, - Arrays.hashCode(this.evictedTemporaryLedgerKeys), - Arrays.hashCode(this.evictedPersistentLedgerEntries)); - } - - @Override - public boolean equals(Object object) { - if (!(object instanceof LedgerCloseMetaV2)) { - return false; - } - - LedgerCloseMetaV2 other = (LedgerCloseMetaV2) object; - return Objects.equals(this.ext, other.ext) - && Objects.equals(this.ledgerHeader, other.ledgerHeader) - && Objects.equals(this.txSet, other.txSet) - && Arrays.equals(this.txProcessing, other.txProcessing) - && Arrays.equals(this.upgradesProcessing, other.upgradesProcessing) - && Arrays.equals(this.scpInfo, other.scpInfo) - && Objects.equals(this.totalByteSizeOfBucketList, other.totalByteSizeOfBucketList) - && Arrays.equals(this.evictedTemporaryLedgerKeys, other.evictedTemporaryLedgerKeys) - && Arrays.equals(this.evictedPersistentLedgerEntries, other.evictedPersistentLedgerEntries); - } - - @Override - public String toXdrBase64() throws IOException { - return Base64Factory.getInstance().encodeToString(toXdrByteArray()); - } - - @Override - public byte[] toXdrByteArray() throws IOException { - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - XdrDataOutputStream xdrDataOutputStream = new XdrDataOutputStream(byteArrayOutputStream); - encode(xdrDataOutputStream); - return byteArrayOutputStream.toByteArray(); - } - - public static LedgerCloseMetaV2 fromXdrBase64(String xdr) throws IOException { - byte[] bytes = Base64Factory.getInstance().decode(xdr); - return fromXdrByteArray(bytes); - } - - public static LedgerCloseMetaV2 fromXdrByteArray(byte[] xdr) throws IOException { - ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); - XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); - return decode(xdrDataInputStream); - } - - public static final class Builder { - private ExtensionPoint ext; - private LedgerHeaderHistoryEntry ledgerHeader; - private GeneralizedTransactionSet txSet; - private TransactionResultMeta[] txProcessing; - private UpgradeEntryMeta[] upgradesProcessing; - private SCPHistoryEntry[] scpInfo; - private Uint64 totalByteSizeOfBucketList; - private LedgerKey[] evictedTemporaryLedgerKeys; - private LedgerEntry[] evictedPersistentLedgerEntries; - - public Builder ext(ExtensionPoint ext) { - this.ext = ext; - return this; - } - - public Builder ledgerHeader(LedgerHeaderHistoryEntry ledgerHeader) { - this.ledgerHeader = ledgerHeader; - return this; - } - - public Builder txSet(GeneralizedTransactionSet txSet) { - this.txSet = txSet; - return this; - } - - public Builder txProcessing(TransactionResultMeta[] txProcessing) { - this.txProcessing = txProcessing; - return this; - } - - public Builder upgradesProcessing(UpgradeEntryMeta[] upgradesProcessing) { - this.upgradesProcessing = upgradesProcessing; - return this; - } - - public Builder scpInfo(SCPHistoryEntry[] scpInfo) { - this.scpInfo = scpInfo; - return this; - } - - public Builder totalByteSizeOfBucketList(Uint64 totalByteSizeOfBucketList) { - this.totalByteSizeOfBucketList = totalByteSizeOfBucketList; - return this; - } - - public Builder evictedTemporaryLedgerKeys(LedgerKey[] evictedTemporaryLedgerKeys) { - this.evictedTemporaryLedgerKeys = evictedTemporaryLedgerKeys; - return this; - } - - public Builder evictedPersistentLedgerEntries(LedgerEntry[] evictedPersistentLedgerEntries) { - this.evictedPersistentLedgerEntries = evictedPersistentLedgerEntries; - return this; - } - - public LedgerCloseMetaV2 build() { - LedgerCloseMetaV2 val = new LedgerCloseMetaV2(); - val.setExt(this.ext); - val.setLedgerHeader(this.ledgerHeader); - val.setTxSet(this.txSet); - val.setTxProcessing(this.txProcessing); - val.setUpgradesProcessing(this.upgradesProcessing); - val.setScpInfo(this.scpInfo); - val.setTotalByteSizeOfBucketList(this.totalByteSizeOfBucketList); - val.setEvictedTemporaryLedgerKeys(this.evictedTemporaryLedgerKeys); - val.setEvictedPersistentLedgerEntries(this.evictedPersistentLedgerEntries); - return val; - } - } -} diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerEntry.java b/src/main/java/org/stellar/sdk/xdr/LedgerEntry.java index ebbd53269..c0b8c9b3d 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerEntry.java @@ -37,8 +37,8 @@ // ContractCodeEntry contractCode; // case CONFIG_SETTING: // ConfigSettingEntry configSetting; -// case EXPIRATION: -// ExpirationEntry expiration; +// case TTL: +// TTLEntry ttl; // } // data; // @@ -279,14 +279,14 @@ public void setConfigSetting(ConfigSettingEntry value) { this.configSetting = value; } - private ExpirationEntry expiration; + private TTLEntry ttl; - public ExpirationEntry getExpiration() { - return this.expiration; + public TTLEntry getTtl() { + return this.ttl; } - public void setExpiration(ExpirationEntry value) { - this.expiration = value; + public void setTtl(TTLEntry value) { + this.ttl = value; } public static final class Builder { @@ -300,7 +300,7 @@ public static final class Builder { private ContractDataEntry contractData; private ContractCodeEntry contractCode; private ConfigSettingEntry configSetting; - private ExpirationEntry expiration; + private TTLEntry ttl; public Builder discriminant(LedgerEntryType discriminant) { this.discriminant = discriminant; @@ -352,8 +352,8 @@ public Builder configSetting(ConfigSettingEntry configSetting) { return this; } - public Builder expiration(ExpirationEntry expiration) { - this.expiration = expiration; + public Builder ttl(TTLEntry ttl) { + this.ttl = ttl; return this; } @@ -369,7 +369,7 @@ public LedgerEntryData build() { val.setContractData(this.contractData); val.setContractCode(this.contractCode); val.setConfigSetting(this.configSetting); - val.setExpiration(this.expiration); + val.setTtl(this.ttl); return val; } } @@ -407,8 +407,8 @@ public static void encode(XdrDataOutputStream stream, LedgerEntryData encodedLed case CONFIG_SETTING: ConfigSettingEntry.encode(stream, encodedLedgerEntryData.configSetting); break; - case EXPIRATION: - ExpirationEntry.encode(stream, encodedLedgerEntryData.expiration); + case TTL: + TTLEntry.encode(stream, encodedLedgerEntryData.ttl); break; } } @@ -449,8 +449,8 @@ public static LedgerEntryData decode(XdrDataInputStream stream) throws IOExcepti case CONFIG_SETTING: decodedLedgerEntryData.configSetting = ConfigSettingEntry.decode(stream); break; - case EXPIRATION: - decodedLedgerEntryData.expiration = ExpirationEntry.decode(stream); + case TTL: + decodedLedgerEntryData.ttl = TTLEntry.decode(stream); break; } return decodedLedgerEntryData; @@ -468,7 +468,7 @@ public int hashCode() { this.contractData, this.contractCode, this.configSetting, - this.expiration, + this.ttl, this.type); } @@ -488,7 +488,7 @@ public boolean equals(Object object) { && Objects.equals(this.contractData, other.contractData) && Objects.equals(this.contractCode, other.contractCode) && Objects.equals(this.configSetting, other.configSetting) - && Objects.equals(this.expiration, other.expiration) + && Objects.equals(this.ttl, other.ttl) && Objects.equals(this.type, other.type); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerEntryType.java b/src/main/java/org/stellar/sdk/xdr/LedgerEntryType.java index be137b929..5b8ede55d 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerEntryType.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerEntryType.java @@ -23,7 +23,7 @@ // CONTRACT_DATA = 6, // CONTRACT_CODE = 7, // CONFIG_SETTING = 8, -// EXPIRATION = 9 +// TTL = 9 // }; // =========================================================================== @@ -37,7 +37,7 @@ public enum LedgerEntryType implements XdrElement { CONTRACT_DATA(6), CONTRACT_CODE(7), CONFIG_SETTING(8), - EXPIRATION(9), + TTL(9), ; private int mValue; @@ -71,7 +71,7 @@ public static LedgerEntryType decode(XdrDataInputStream stream) throws IOExcepti case 8: return CONFIG_SETTING; case 9: - return EXPIRATION; + return TTL; default: throw new RuntimeException("Unknown enum value: " + value); } diff --git a/src/main/java/org/stellar/sdk/xdr/LedgerKey.java b/src/main/java/org/stellar/sdk/xdr/LedgerKey.java index bcc4d7458..b3eb4deb1 100644 --- a/src/main/java/org/stellar/sdk/xdr/LedgerKey.java +++ b/src/main/java/org/stellar/sdk/xdr/LedgerKey.java @@ -70,12 +70,12 @@ // { // ConfigSettingID configSettingID; // } configSetting; -// case EXPIRATION: +// case TTL: // struct // { -// // Hash of the LedgerKey that is associated with this ExpirationEntry +// // Hash of the LedgerKey that is associated with this TTLEntry // Hash keyHash; -// } expiration; +// } ttl; // }; // =========================================================================== @@ -182,14 +182,14 @@ public void setConfigSetting(LedgerKeyConfigSetting value) { this.configSetting = value; } - private LedgerKeyExpiration expiration; + private LedgerKeyTtl ttl; - public LedgerKeyExpiration getExpiration() { - return this.expiration; + public LedgerKeyTtl getTtl() { + return this.ttl; } - public void setExpiration(LedgerKeyExpiration value) { - this.expiration = value; + public void setTtl(LedgerKeyTtl value) { + this.ttl = value; } public static final class Builder { @@ -203,7 +203,7 @@ public static final class Builder { private LedgerKeyContractData contractData; private LedgerKeyContractCode contractCode; private LedgerKeyConfigSetting configSetting; - private LedgerKeyExpiration expiration; + private LedgerKeyTtl ttl; public Builder discriminant(LedgerEntryType discriminant) { this.discriminant = discriminant; @@ -255,8 +255,8 @@ public Builder configSetting(LedgerKeyConfigSetting configSetting) { return this; } - public Builder expiration(LedgerKeyExpiration expiration) { - this.expiration = expiration; + public Builder ttl(LedgerKeyTtl ttl) { + this.ttl = ttl; return this; } @@ -272,7 +272,7 @@ public LedgerKey build() { val.setContractData(this.contractData); val.setContractCode(this.contractCode); val.setConfigSetting(this.configSetting); - val.setExpiration(this.expiration); + val.setTtl(this.ttl); return val; } } @@ -310,8 +310,8 @@ public static void encode(XdrDataOutputStream stream, LedgerKey encodedLedgerKey case CONFIG_SETTING: LedgerKeyConfigSetting.encode(stream, encodedLedgerKey.configSetting); break; - case EXPIRATION: - LedgerKeyExpiration.encode(stream, encodedLedgerKey.expiration); + case TTL: + LedgerKeyTtl.encode(stream, encodedLedgerKey.ttl); break; } } @@ -352,8 +352,8 @@ public static LedgerKey decode(XdrDataInputStream stream) throws IOException { case CONFIG_SETTING: decodedLedgerKey.configSetting = LedgerKeyConfigSetting.decode(stream); break; - case EXPIRATION: - decodedLedgerKey.expiration = LedgerKeyExpiration.decode(stream); + case TTL: + decodedLedgerKey.ttl = LedgerKeyTtl.decode(stream); break; } return decodedLedgerKey; @@ -371,7 +371,7 @@ public int hashCode() { this.contractData, this.contractCode, this.configSetting, - this.expiration, + this.ttl, this.type); } @@ -391,7 +391,7 @@ public boolean equals(Object object) { && Objects.equals(this.contractData, other.contractData) && Objects.equals(this.contractCode, other.contractCode) && Objects.equals(this.configSetting, other.configSetting) - && Objects.equals(this.expiration, other.expiration) + && Objects.equals(this.ttl, other.ttl) && Objects.equals(this.type, other.type); } @@ -1272,8 +1272,8 @@ public LedgerKeyConfigSetting build() { } } - public static class LedgerKeyExpiration implements XdrElement { - public LedgerKeyExpiration() {} + public static class LedgerKeyTtl implements XdrElement { + public LedgerKeyTtl() {} private Hash keyHash; @@ -1285,20 +1285,19 @@ public void setKeyHash(Hash value) { this.keyHash = value; } - public static void encode( - XdrDataOutputStream stream, LedgerKeyExpiration encodedLedgerKeyExpiration) + public static void encode(XdrDataOutputStream stream, LedgerKeyTtl encodedLedgerKeyTtl) throws IOException { - Hash.encode(stream, encodedLedgerKeyExpiration.keyHash); + Hash.encode(stream, encodedLedgerKeyTtl.keyHash); } public void encode(XdrDataOutputStream stream) throws IOException { encode(stream, this); } - public static LedgerKeyExpiration decode(XdrDataInputStream stream) throws IOException { - LedgerKeyExpiration decodedLedgerKeyExpiration = new LedgerKeyExpiration(); - decodedLedgerKeyExpiration.keyHash = Hash.decode(stream); - return decodedLedgerKeyExpiration; + public static LedgerKeyTtl decode(XdrDataInputStream stream) throws IOException { + LedgerKeyTtl decodedLedgerKeyTtl = new LedgerKeyTtl(); + decodedLedgerKeyTtl.keyHash = Hash.decode(stream); + return decodedLedgerKeyTtl; } @Override @@ -1308,11 +1307,11 @@ public int hashCode() { @Override public boolean equals(Object object) { - if (!(object instanceof LedgerKeyExpiration)) { + if (!(object instanceof LedgerKeyTtl)) { return false; } - LedgerKeyExpiration other = (LedgerKeyExpiration) object; + LedgerKeyTtl other = (LedgerKeyTtl) object; return Objects.equals(this.keyHash, other.keyHash); } @@ -1329,12 +1328,12 @@ public byte[] toXdrByteArray() throws IOException { return byteArrayOutputStream.toByteArray(); } - public static LedgerKeyExpiration fromXdrBase64(String xdr) throws IOException { + public static LedgerKeyTtl fromXdrBase64(String xdr) throws IOException { byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } - public static LedgerKeyExpiration fromXdrByteArray(byte[] xdr) throws IOException { + public static LedgerKeyTtl fromXdrByteArray(byte[] xdr) throws IOException { ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); return decode(xdrDataInputStream); @@ -1348,8 +1347,8 @@ public Builder keyHash(Hash keyHash) { return this; } - public LedgerKeyExpiration build() { - LedgerKeyExpiration val = new LedgerKeyExpiration(); + public LedgerKeyTtl build() { + LedgerKeyTtl val = new LedgerKeyTtl(); val.setKeyHash(this.keyHash); return val; } diff --git a/src/main/java/org/stellar/sdk/xdr/Operation.java b/src/main/java/org/stellar/sdk/xdr/Operation.java index c8fe9d9db..be4e9f046 100644 --- a/src/main/java/org/stellar/sdk/xdr/Operation.java +++ b/src/main/java/org/stellar/sdk/xdr/Operation.java @@ -72,8 +72,8 @@ // LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; // case INVOKE_HOST_FUNCTION: // InvokeHostFunctionOp invokeHostFunctionOp; -// case BUMP_FOOTPRINT_EXPIRATION: -// BumpFootprintExpirationOp bumpFootprintExpirationOp; +// case EXTEND_FOOTPRINT_TTL: +// ExtendFootprintTTLOp extendFootprintTTLOp; // case RESTORE_FOOTPRINT: // RestoreFootprintOp restoreFootprintOp; // } @@ -434,14 +434,14 @@ public void setInvokeHostFunctionOp(InvokeHostFunctionOp value) { this.invokeHostFunctionOp = value; } - private BumpFootprintExpirationOp bumpFootprintExpirationOp; + private ExtendFootprintTTLOp extendFootprintTTLOp; - public BumpFootprintExpirationOp getBumpFootprintExpirationOp() { - return this.bumpFootprintExpirationOp; + public ExtendFootprintTTLOp getExtendFootprintTTLOp() { + return this.extendFootprintTTLOp; } - public void setBumpFootprintExpirationOp(BumpFootprintExpirationOp value) { - this.bumpFootprintExpirationOp = value; + public void setExtendFootprintTTLOp(ExtendFootprintTTLOp value) { + this.extendFootprintTTLOp = value; } private RestoreFootprintOp restoreFootprintOp; @@ -479,7 +479,7 @@ public static final class Builder { private LiquidityPoolDepositOp liquidityPoolDepositOp; private LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; private InvokeHostFunctionOp invokeHostFunctionOp; - private BumpFootprintExpirationOp bumpFootprintExpirationOp; + private ExtendFootprintTTLOp extendFootprintTTLOp; private RestoreFootprintOp restoreFootprintOp; public Builder discriminant(OperationType discriminant) { @@ -605,9 +605,8 @@ public Builder invokeHostFunctionOp(InvokeHostFunctionOp invokeHostFunctionOp) { return this; } - public Builder bumpFootprintExpirationOp( - BumpFootprintExpirationOp bumpFootprintExpirationOp) { - this.bumpFootprintExpirationOp = bumpFootprintExpirationOp; + public Builder extendFootprintTTLOp(ExtendFootprintTTLOp extendFootprintTTLOp) { + this.extendFootprintTTLOp = extendFootprintTTLOp; return this; } @@ -642,7 +641,7 @@ public OperationBody build() { val.setLiquidityPoolDepositOp(this.liquidityPoolDepositOp); val.setLiquidityPoolWithdrawOp(this.liquidityPoolWithdrawOp); val.setInvokeHostFunctionOp(this.invokeHostFunctionOp); - val.setBumpFootprintExpirationOp(this.bumpFootprintExpirationOp); + val.setExtendFootprintTTLOp(this.extendFootprintTTLOp); val.setRestoreFootprintOp(this.restoreFootprintOp); return val; } @@ -730,8 +729,8 @@ public static void encode(XdrDataOutputStream stream, OperationBody encodedOpera case INVOKE_HOST_FUNCTION: InvokeHostFunctionOp.encode(stream, encodedOperationBody.invokeHostFunctionOp); break; - case BUMP_FOOTPRINT_EXPIRATION: - BumpFootprintExpirationOp.encode(stream, encodedOperationBody.bumpFootprintExpirationOp); + case EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLOp.encode(stream, encodedOperationBody.extendFootprintTTLOp); break; case RESTORE_FOOTPRINT: RestoreFootprintOp.encode(stream, encodedOperationBody.restoreFootprintOp); @@ -824,8 +823,8 @@ public static OperationBody decode(XdrDataInputStream stream) throws IOException case INVOKE_HOST_FUNCTION: decodedOperationBody.invokeHostFunctionOp = InvokeHostFunctionOp.decode(stream); break; - case BUMP_FOOTPRINT_EXPIRATION: - decodedOperationBody.bumpFootprintExpirationOp = BumpFootprintExpirationOp.decode(stream); + case EXTEND_FOOTPRINT_TTL: + decodedOperationBody.extendFootprintTTLOp = ExtendFootprintTTLOp.decode(stream); break; case RESTORE_FOOTPRINT: decodedOperationBody.restoreFootprintOp = RestoreFootprintOp.decode(stream); @@ -860,7 +859,7 @@ public int hashCode() { this.liquidityPoolDepositOp, this.liquidityPoolWithdrawOp, this.invokeHostFunctionOp, - this.bumpFootprintExpirationOp, + this.extendFootprintTTLOp, this.restoreFootprintOp, this.type); } @@ -896,7 +895,7 @@ public boolean equals(Object object) { && Objects.equals(this.liquidityPoolDepositOp, other.liquidityPoolDepositOp) && Objects.equals(this.liquidityPoolWithdrawOp, other.liquidityPoolWithdrawOp) && Objects.equals(this.invokeHostFunctionOp, other.invokeHostFunctionOp) - && Objects.equals(this.bumpFootprintExpirationOp, other.bumpFootprintExpirationOp) + && Objects.equals(this.extendFootprintTTLOp, other.extendFootprintTTLOp) && Objects.equals(this.restoreFootprintOp, other.restoreFootprintOp) && Objects.equals(this.type, other.type); } diff --git a/src/main/java/org/stellar/sdk/xdr/OperationResult.java b/src/main/java/org/stellar/sdk/xdr/OperationResult.java index 13d2d51a2..27b4542f6 100644 --- a/src/main/java/org/stellar/sdk/xdr/OperationResult.java +++ b/src/main/java/org/stellar/sdk/xdr/OperationResult.java @@ -68,8 +68,8 @@ // LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; // case INVOKE_HOST_FUNCTION: // InvokeHostFunctionResult invokeHostFunctionResult; -// case BUMP_FOOTPRINT_EXPIRATION: -// BumpFootprintExpirationResult bumpFootprintExpirationResult; +// case EXTEND_FOOTPRINT_TTL: +// ExtendFootprintTTLResult extendFootprintTTLResult; // case RESTORE_FOOTPRINT: // RestoreFootprintResult restoreFootprintResult; // } @@ -473,14 +473,14 @@ public void setInvokeHostFunctionResult(InvokeHostFunctionResult value) { this.invokeHostFunctionResult = value; } - private BumpFootprintExpirationResult bumpFootprintExpirationResult; + private ExtendFootprintTTLResult extendFootprintTTLResult; - public BumpFootprintExpirationResult getBumpFootprintExpirationResult() { - return this.bumpFootprintExpirationResult; + public ExtendFootprintTTLResult getExtendFootprintTTLResult() { + return this.extendFootprintTTLResult; } - public void setBumpFootprintExpirationResult(BumpFootprintExpirationResult value) { - this.bumpFootprintExpirationResult = value; + public void setExtendFootprintTTLResult(ExtendFootprintTTLResult value) { + this.extendFootprintTTLResult = value; } private RestoreFootprintResult restoreFootprintResult; @@ -520,7 +520,7 @@ public static final class Builder { private LiquidityPoolDepositResult liquidityPoolDepositResult; private LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; private InvokeHostFunctionResult invokeHostFunctionResult; - private BumpFootprintExpirationResult bumpFootprintExpirationResult; + private ExtendFootprintTTLResult extendFootprintTTLResult; private RestoreFootprintResult restoreFootprintResult; public Builder discriminant(OperationType discriminant) { @@ -663,9 +663,8 @@ public Builder invokeHostFunctionResult(InvokeHostFunctionResult invokeHostFunct return this; } - public Builder bumpFootprintExpirationResult( - BumpFootprintExpirationResult bumpFootprintExpirationResult) { - this.bumpFootprintExpirationResult = bumpFootprintExpirationResult; + public Builder extendFootprintTTLResult(ExtendFootprintTTLResult extendFootprintTTLResult) { + this.extendFootprintTTLResult = extendFootprintTTLResult; return this; } @@ -702,7 +701,7 @@ public OperationResultTr build() { val.setLiquidityPoolDepositResult(this.liquidityPoolDepositResult); val.setLiquidityPoolWithdrawResult(this.liquidityPoolWithdrawResult); val.setInvokeHostFunctionResult(this.invokeHostFunctionResult); - val.setBumpFootprintExpirationResult(this.bumpFootprintExpirationResult); + val.setExtendFootprintTTLResult(this.extendFootprintTTLResult); val.setRestoreFootprintResult(this.restoreFootprintResult); return val; } @@ -800,9 +799,9 @@ public static void encode( InvokeHostFunctionResult.encode( stream, encodedOperationResultTr.invokeHostFunctionResult); break; - case BUMP_FOOTPRINT_EXPIRATION: - BumpFootprintExpirationResult.encode( - stream, encodedOperationResultTr.bumpFootprintExpirationResult); + case EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLResult.encode( + stream, encodedOperationResultTr.extendFootprintTTLResult); break; case RESTORE_FOOTPRINT: RestoreFootprintResult.encode(stream, encodedOperationResultTr.restoreFootprintResult); @@ -905,9 +904,9 @@ public static OperationResultTr decode(XdrDataInputStream stream) throws IOExcep decodedOperationResultTr.invokeHostFunctionResult = InvokeHostFunctionResult.decode(stream); break; - case BUMP_FOOTPRINT_EXPIRATION: - decodedOperationResultTr.bumpFootprintExpirationResult = - BumpFootprintExpirationResult.decode(stream); + case EXTEND_FOOTPRINT_TTL: + decodedOperationResultTr.extendFootprintTTLResult = + ExtendFootprintTTLResult.decode(stream); break; case RESTORE_FOOTPRINT: decodedOperationResultTr.restoreFootprintResult = RestoreFootprintResult.decode(stream); @@ -944,7 +943,7 @@ public int hashCode() { this.liquidityPoolDepositResult, this.liquidityPoolWithdrawResult, this.invokeHostFunctionResult, - this.bumpFootprintExpirationResult, + this.extendFootprintTTLResult, this.restoreFootprintResult, this.type); } @@ -985,7 +984,7 @@ public boolean equals(Object object) { && Objects.equals(this.liquidityPoolDepositResult, other.liquidityPoolDepositResult) && Objects.equals(this.liquidityPoolWithdrawResult, other.liquidityPoolWithdrawResult) && Objects.equals(this.invokeHostFunctionResult, other.invokeHostFunctionResult) - && Objects.equals(this.bumpFootprintExpirationResult, other.bumpFootprintExpirationResult) + && Objects.equals(this.extendFootprintTTLResult, other.extendFootprintTTLResult) && Objects.equals(this.restoreFootprintResult, other.restoreFootprintResult) && Objects.equals(this.type, other.type); } diff --git a/src/main/java/org/stellar/sdk/xdr/OperationType.java b/src/main/java/org/stellar/sdk/xdr/OperationType.java index d2c51923e..18dc637e3 100644 --- a/src/main/java/org/stellar/sdk/xdr/OperationType.java +++ b/src/main/java/org/stellar/sdk/xdr/OperationType.java @@ -39,7 +39,7 @@ // LIQUIDITY_POOL_DEPOSIT = 22, // LIQUIDITY_POOL_WITHDRAW = 23, // INVOKE_HOST_FUNCTION = 24, -// BUMP_FOOTPRINT_EXPIRATION = 25, +// EXTEND_FOOTPRINT_TTL = 25, // RESTORE_FOOTPRINT = 26 // }; @@ -70,7 +70,7 @@ public enum OperationType implements XdrElement { LIQUIDITY_POOL_DEPOSIT(22), LIQUIDITY_POOL_WITHDRAW(23), INVOKE_HOST_FUNCTION(24), - BUMP_FOOTPRINT_EXPIRATION(25), + EXTEND_FOOTPRINT_TTL(25), RESTORE_FOOTPRINT(26), ; private int mValue; @@ -137,7 +137,7 @@ public static OperationType decode(XdrDataInputStream stream) throws IOException case 24: return INVOKE_HOST_FUNCTION; case 25: - return BUMP_FOOTPRINT_EXPIRATION; + return EXTEND_FOOTPRINT_TTL; case 26: return RESTORE_FOOTPRINT; default: diff --git a/src/main/java/org/stellar/sdk/xdr/SorobanTransactionData.java b/src/main/java/org/stellar/sdk/xdr/SorobanTransactionData.java index 66a21113d..368134186 100644 --- a/src/main/java/org/stellar/sdk/xdr/SorobanTransactionData.java +++ b/src/main/java/org/stellar/sdk/xdr/SorobanTransactionData.java @@ -17,8 +17,16 @@ // { // ExtensionPoint ext; // SorobanResources resources; -// // Portion of transaction `fee` allocated to refundable fees. -// int64 refundableFee; +// // Amount of the transaction `fee` allocated to the Soroban resource fees. +// // The fraction of `resourceFee` corresponding to `resources` specified +// // above is *not* refundable (i.e. fees for instructions, ledger I/O), as +// // well as fees for the transaction size. +// // The remaining part of the fee is refundable and the charged value is +// // based on the actual consumption of refundable resources (events, ledger +// // rent bumps). +// // The `inclusionFee` used for prioritization of the transaction is defined +// // as `tx.fee - resourceFee`. +// int64 resourceFee; // }; // =========================================================================== @@ -45,14 +53,14 @@ public void setResources(SorobanResources value) { this.resources = value; } - private Int64 refundableFee; + private Int64 resourceFee; - public Int64 getRefundableFee() { - return this.refundableFee; + public Int64 getResourceFee() { + return this.resourceFee; } - public void setRefundableFee(Int64 value) { - this.refundableFee = value; + public void setResourceFee(Int64 value) { + this.resourceFee = value; } public static void encode( @@ -60,7 +68,7 @@ public static void encode( throws IOException { ExtensionPoint.encode(stream, encodedSorobanTransactionData.ext); SorobanResources.encode(stream, encodedSorobanTransactionData.resources); - Int64.encode(stream, encodedSorobanTransactionData.refundableFee); + Int64.encode(stream, encodedSorobanTransactionData.resourceFee); } public void encode(XdrDataOutputStream stream) throws IOException { @@ -71,13 +79,13 @@ public static SorobanTransactionData decode(XdrDataInputStream stream) throws IO SorobanTransactionData decodedSorobanTransactionData = new SorobanTransactionData(); decodedSorobanTransactionData.ext = ExtensionPoint.decode(stream); decodedSorobanTransactionData.resources = SorobanResources.decode(stream); - decodedSorobanTransactionData.refundableFee = Int64.decode(stream); + decodedSorobanTransactionData.resourceFee = Int64.decode(stream); return decodedSorobanTransactionData; } @Override public int hashCode() { - return Objects.hash(this.ext, this.resources, this.refundableFee); + return Objects.hash(this.ext, this.resources, this.resourceFee); } @Override @@ -89,7 +97,7 @@ public boolean equals(Object object) { SorobanTransactionData other = (SorobanTransactionData) object; return Objects.equals(this.ext, other.ext) && Objects.equals(this.resources, other.resources) - && Objects.equals(this.refundableFee, other.refundableFee); + && Objects.equals(this.resourceFee, other.resourceFee); } @Override @@ -119,7 +127,7 @@ public static SorobanTransactionData fromXdrByteArray(byte[] xdr) throws IOExcep public static final class Builder { private ExtensionPoint ext; private SorobanResources resources; - private Int64 refundableFee; + private Int64 resourceFee; public Builder ext(ExtensionPoint ext) { this.ext = ext; @@ -131,8 +139,8 @@ public Builder resources(SorobanResources resources) { return this; } - public Builder refundableFee(Int64 refundableFee) { - this.refundableFee = refundableFee; + public Builder resourceFee(Int64 resourceFee) { + this.resourceFee = resourceFee; return this; } @@ -140,7 +148,7 @@ public SorobanTransactionData build() { SorobanTransactionData val = new SorobanTransactionData(); val.setExt(this.ext); val.setResources(this.resources); - val.setRefundableFee(this.refundableFee); + val.setResourceFee(this.resourceFee); return val; } } diff --git a/src/main/java/org/stellar/sdk/xdr/StateExpirationSettings.java b/src/main/java/org/stellar/sdk/xdr/StateArchivalSettings.java similarity index 53% rename from src/main/java/org/stellar/sdk/xdr/StateExpirationSettings.java rename to src/main/java/org/stellar/sdk/xdr/StateArchivalSettings.java index bb508584b..9d3f6243e 100644 --- a/src/main/java/org/stellar/sdk/xdr/StateExpirationSettings.java +++ b/src/main/java/org/stellar/sdk/xdr/StateArchivalSettings.java @@ -13,17 +13,17 @@ // === xdr source ============================================================ -// struct StateExpirationSettings { -// uint32 maxEntryExpiration; -// uint32 minTempEntryExpiration; -// uint32 minPersistentEntryExpiration; +// struct StateArchivalSettings { +// uint32 maxEntryTTL; +// uint32 minTemporaryTTL; +// uint32 minPersistentTTL; // // // rent_fee = wfee_rate_average / rent_rate_denominator_for_type // int64 persistentRentRateDenominator; // int64 tempRentRateDenominator; // -// // max number of entries that emit expiration meta in a single ledger -// uint32 maxEntriesToExpire; +// // max number of entries that emit archival meta in a single ledger +// uint32 maxEntriesToArchive; // // // Number of snapshots to use when calculating average BucketList size // uint32 bucketListSizeWindowSampleSize; @@ -36,37 +36,37 @@ // }; // =========================================================================== -public class StateExpirationSettings implements XdrElement { - public StateExpirationSettings() {} +public class StateArchivalSettings implements XdrElement { + public StateArchivalSettings() {} - private Uint32 maxEntryExpiration; + private Uint32 maxEntryTTL; - public Uint32 getMaxEntryExpiration() { - return this.maxEntryExpiration; + public Uint32 getMaxEntryTTL() { + return this.maxEntryTTL; } - public void setMaxEntryExpiration(Uint32 value) { - this.maxEntryExpiration = value; + public void setMaxEntryTTL(Uint32 value) { + this.maxEntryTTL = value; } - private Uint32 minTempEntryExpiration; + private Uint32 minTemporaryTTL; - public Uint32 getMinTempEntryExpiration() { - return this.minTempEntryExpiration; + public Uint32 getMinTemporaryTTL() { + return this.minTemporaryTTL; } - public void setMinTempEntryExpiration(Uint32 value) { - this.minTempEntryExpiration = value; + public void setMinTemporaryTTL(Uint32 value) { + this.minTemporaryTTL = value; } - private Uint32 minPersistentEntryExpiration; + private Uint32 minPersistentTTL; - public Uint32 getMinPersistentEntryExpiration() { - return this.minPersistentEntryExpiration; + public Uint32 getMinPersistentTTL() { + return this.minPersistentTTL; } - public void setMinPersistentEntryExpiration(Uint32 value) { - this.minPersistentEntryExpiration = value; + public void setMinPersistentTTL(Uint32 value) { + this.minPersistentTTL = value; } private Int64 persistentRentRateDenominator; @@ -89,14 +89,14 @@ public void setTempRentRateDenominator(Int64 value) { this.tempRentRateDenominator = value; } - private Uint32 maxEntriesToExpire; + private Uint32 maxEntriesToArchive; - public Uint32 getMaxEntriesToExpire() { - return this.maxEntriesToExpire; + public Uint32 getMaxEntriesToArchive() { + return this.maxEntriesToArchive; } - public void setMaxEntriesToExpire(Uint32 value) { - this.maxEntriesToExpire = value; + public void setMaxEntriesToArchive(Uint32 value) { + this.maxEntriesToArchive = value; } private Uint32 bucketListSizeWindowSampleSize; @@ -130,46 +130,46 @@ public void setStartingEvictionScanLevel(Uint32 value) { } public static void encode( - XdrDataOutputStream stream, StateExpirationSettings encodedStateExpirationSettings) + XdrDataOutputStream stream, StateArchivalSettings encodedStateArchivalSettings) throws IOException { - Uint32.encode(stream, encodedStateExpirationSettings.maxEntryExpiration); - Uint32.encode(stream, encodedStateExpirationSettings.minTempEntryExpiration); - Uint32.encode(stream, encodedStateExpirationSettings.minPersistentEntryExpiration); - Int64.encode(stream, encodedStateExpirationSettings.persistentRentRateDenominator); - Int64.encode(stream, encodedStateExpirationSettings.tempRentRateDenominator); - Uint32.encode(stream, encodedStateExpirationSettings.maxEntriesToExpire); - Uint32.encode(stream, encodedStateExpirationSettings.bucketListSizeWindowSampleSize); - Uint64.encode(stream, encodedStateExpirationSettings.evictionScanSize); - Uint32.encode(stream, encodedStateExpirationSettings.startingEvictionScanLevel); + Uint32.encode(stream, encodedStateArchivalSettings.maxEntryTTL); + Uint32.encode(stream, encodedStateArchivalSettings.minTemporaryTTL); + Uint32.encode(stream, encodedStateArchivalSettings.minPersistentTTL); + Int64.encode(stream, encodedStateArchivalSettings.persistentRentRateDenominator); + Int64.encode(stream, encodedStateArchivalSettings.tempRentRateDenominator); + Uint32.encode(stream, encodedStateArchivalSettings.maxEntriesToArchive); + Uint32.encode(stream, encodedStateArchivalSettings.bucketListSizeWindowSampleSize); + Uint64.encode(stream, encodedStateArchivalSettings.evictionScanSize); + Uint32.encode(stream, encodedStateArchivalSettings.startingEvictionScanLevel); } public void encode(XdrDataOutputStream stream) throws IOException { encode(stream, this); } - public static StateExpirationSettings decode(XdrDataInputStream stream) throws IOException { - StateExpirationSettings decodedStateExpirationSettings = new StateExpirationSettings(); - decodedStateExpirationSettings.maxEntryExpiration = Uint32.decode(stream); - decodedStateExpirationSettings.minTempEntryExpiration = Uint32.decode(stream); - decodedStateExpirationSettings.minPersistentEntryExpiration = Uint32.decode(stream); - decodedStateExpirationSettings.persistentRentRateDenominator = Int64.decode(stream); - decodedStateExpirationSettings.tempRentRateDenominator = Int64.decode(stream); - decodedStateExpirationSettings.maxEntriesToExpire = Uint32.decode(stream); - decodedStateExpirationSettings.bucketListSizeWindowSampleSize = Uint32.decode(stream); - decodedStateExpirationSettings.evictionScanSize = Uint64.decode(stream); - decodedStateExpirationSettings.startingEvictionScanLevel = Uint32.decode(stream); - return decodedStateExpirationSettings; + public static StateArchivalSettings decode(XdrDataInputStream stream) throws IOException { + StateArchivalSettings decodedStateArchivalSettings = new StateArchivalSettings(); + decodedStateArchivalSettings.maxEntryTTL = Uint32.decode(stream); + decodedStateArchivalSettings.minTemporaryTTL = Uint32.decode(stream); + decodedStateArchivalSettings.minPersistentTTL = Uint32.decode(stream); + decodedStateArchivalSettings.persistentRentRateDenominator = Int64.decode(stream); + decodedStateArchivalSettings.tempRentRateDenominator = Int64.decode(stream); + decodedStateArchivalSettings.maxEntriesToArchive = Uint32.decode(stream); + decodedStateArchivalSettings.bucketListSizeWindowSampleSize = Uint32.decode(stream); + decodedStateArchivalSettings.evictionScanSize = Uint64.decode(stream); + decodedStateArchivalSettings.startingEvictionScanLevel = Uint32.decode(stream); + return decodedStateArchivalSettings; } @Override public int hashCode() { return Objects.hash( - this.maxEntryExpiration, - this.minTempEntryExpiration, - this.minPersistentEntryExpiration, + this.maxEntryTTL, + this.minTemporaryTTL, + this.minPersistentTTL, this.persistentRentRateDenominator, this.tempRentRateDenominator, - this.maxEntriesToExpire, + this.maxEntriesToArchive, this.bucketListSizeWindowSampleSize, this.evictionScanSize, this.startingEvictionScanLevel); @@ -177,17 +177,17 @@ public int hashCode() { @Override public boolean equals(Object object) { - if (!(object instanceof StateExpirationSettings)) { + if (!(object instanceof StateArchivalSettings)) { return false; } - StateExpirationSettings other = (StateExpirationSettings) object; - return Objects.equals(this.maxEntryExpiration, other.maxEntryExpiration) - && Objects.equals(this.minTempEntryExpiration, other.minTempEntryExpiration) - && Objects.equals(this.minPersistentEntryExpiration, other.minPersistentEntryExpiration) + StateArchivalSettings other = (StateArchivalSettings) object; + return Objects.equals(this.maxEntryTTL, other.maxEntryTTL) + && Objects.equals(this.minTemporaryTTL, other.minTemporaryTTL) + && Objects.equals(this.minPersistentTTL, other.minPersistentTTL) && Objects.equals(this.persistentRentRateDenominator, other.persistentRentRateDenominator) && Objects.equals(this.tempRentRateDenominator, other.tempRentRateDenominator) - && Objects.equals(this.maxEntriesToExpire, other.maxEntriesToExpire) + && Objects.equals(this.maxEntriesToArchive, other.maxEntriesToArchive) && Objects.equals(this.bucketListSizeWindowSampleSize, other.bucketListSizeWindowSampleSize) && Objects.equals(this.evictionScanSize, other.evictionScanSize) && Objects.equals(this.startingEvictionScanLevel, other.startingEvictionScanLevel); @@ -206,40 +206,40 @@ public byte[] toXdrByteArray() throws IOException { return byteArrayOutputStream.toByteArray(); } - public static StateExpirationSettings fromXdrBase64(String xdr) throws IOException { + public static StateArchivalSettings fromXdrBase64(String xdr) throws IOException { byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } - public static StateExpirationSettings fromXdrByteArray(byte[] xdr) throws IOException { + public static StateArchivalSettings fromXdrByteArray(byte[] xdr) throws IOException { ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); return decode(xdrDataInputStream); } public static final class Builder { - private Uint32 maxEntryExpiration; - private Uint32 minTempEntryExpiration; - private Uint32 minPersistentEntryExpiration; + private Uint32 maxEntryTTL; + private Uint32 minTemporaryTTL; + private Uint32 minPersistentTTL; private Int64 persistentRentRateDenominator; private Int64 tempRentRateDenominator; - private Uint32 maxEntriesToExpire; + private Uint32 maxEntriesToArchive; private Uint32 bucketListSizeWindowSampleSize; private Uint64 evictionScanSize; private Uint32 startingEvictionScanLevel; - public Builder maxEntryExpiration(Uint32 maxEntryExpiration) { - this.maxEntryExpiration = maxEntryExpiration; + public Builder maxEntryTTL(Uint32 maxEntryTTL) { + this.maxEntryTTL = maxEntryTTL; return this; } - public Builder minTempEntryExpiration(Uint32 minTempEntryExpiration) { - this.minTempEntryExpiration = minTempEntryExpiration; + public Builder minTemporaryTTL(Uint32 minTemporaryTTL) { + this.minTemporaryTTL = minTemporaryTTL; return this; } - public Builder minPersistentEntryExpiration(Uint32 minPersistentEntryExpiration) { - this.minPersistentEntryExpiration = minPersistentEntryExpiration; + public Builder minPersistentTTL(Uint32 minPersistentTTL) { + this.minPersistentTTL = minPersistentTTL; return this; } @@ -253,8 +253,8 @@ public Builder tempRentRateDenominator(Int64 tempRentRateDenominator) { return this; } - public Builder maxEntriesToExpire(Uint32 maxEntriesToExpire) { - this.maxEntriesToExpire = maxEntriesToExpire; + public Builder maxEntriesToArchive(Uint32 maxEntriesToArchive) { + this.maxEntriesToArchive = maxEntriesToArchive; return this; } @@ -273,14 +273,14 @@ public Builder startingEvictionScanLevel(Uint32 startingEvictionScanLevel) { return this; } - public StateExpirationSettings build() { - StateExpirationSettings val = new StateExpirationSettings(); - val.setMaxEntryExpiration(this.maxEntryExpiration); - val.setMinTempEntryExpiration(this.minTempEntryExpiration); - val.setMinPersistentEntryExpiration(this.minPersistentEntryExpiration); + public StateArchivalSettings build() { + StateArchivalSettings val = new StateArchivalSettings(); + val.setMaxEntryTTL(this.maxEntryTTL); + val.setMinTemporaryTTL(this.minTemporaryTTL); + val.setMinPersistentTTL(this.minPersistentTTL); val.setPersistentRentRateDenominator(this.persistentRentRateDenominator); val.setTempRentRateDenominator(this.tempRentRateDenominator); - val.setMaxEntriesToExpire(this.maxEntriesToExpire); + val.setMaxEntriesToArchive(this.maxEntriesToArchive); val.setBucketListSizeWindowSampleSize(this.bucketListSizeWindowSampleSize); val.setEvictionScanSize(this.evictionScanSize); val.setStartingEvictionScanLevel(this.startingEvictionScanLevel); diff --git a/src/main/java/org/stellar/sdk/xdr/StoredDebugTransactionSet.java b/src/main/java/org/stellar/sdk/xdr/StoredDebugTransactionSet.java new file mode 100644 index 000000000..3520de742 --- /dev/null +++ b/src/main/java/org/stellar/sdk/xdr/StoredDebugTransactionSet.java @@ -0,0 +1,146 @@ +// Automatically generated by xdrgen +// DO NOT EDIT or your changes may be overwritten + +package org.stellar.sdk.xdr; + +import static org.stellar.sdk.xdr.Constants.*; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Objects; +import org.stellar.sdk.Base64Factory; + +// === xdr source ============================================================ + +// struct StoredDebugTransactionSet +// { +// StoredTransactionSet txSet; +// uint32 ledgerSeq; +// StellarValue scpValue; +// }; + +// =========================================================================== +public class StoredDebugTransactionSet implements XdrElement { + public StoredDebugTransactionSet() {} + + private StoredTransactionSet txSet; + + public StoredTransactionSet getTxSet() { + return this.txSet; + } + + public void setTxSet(StoredTransactionSet value) { + this.txSet = value; + } + + private Uint32 ledgerSeq; + + public Uint32 getLedgerSeq() { + return this.ledgerSeq; + } + + public void setLedgerSeq(Uint32 value) { + this.ledgerSeq = value; + } + + private StellarValue scpValue; + + public StellarValue getScpValue() { + return this.scpValue; + } + + public void setScpValue(StellarValue value) { + this.scpValue = value; + } + + public static void encode( + XdrDataOutputStream stream, StoredDebugTransactionSet encodedStoredDebugTransactionSet) + throws IOException { + StoredTransactionSet.encode(stream, encodedStoredDebugTransactionSet.txSet); + Uint32.encode(stream, encodedStoredDebugTransactionSet.ledgerSeq); + StellarValue.encode(stream, encodedStoredDebugTransactionSet.scpValue); + } + + public void encode(XdrDataOutputStream stream) throws IOException { + encode(stream, this); + } + + public static StoredDebugTransactionSet decode(XdrDataInputStream stream) throws IOException { + StoredDebugTransactionSet decodedStoredDebugTransactionSet = new StoredDebugTransactionSet(); + decodedStoredDebugTransactionSet.txSet = StoredTransactionSet.decode(stream); + decodedStoredDebugTransactionSet.ledgerSeq = Uint32.decode(stream); + decodedStoredDebugTransactionSet.scpValue = StellarValue.decode(stream); + return decodedStoredDebugTransactionSet; + } + + @Override + public int hashCode() { + return Objects.hash(this.txSet, this.ledgerSeq, this.scpValue); + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof StoredDebugTransactionSet)) { + return false; + } + + StoredDebugTransactionSet other = (StoredDebugTransactionSet) object; + return Objects.equals(this.txSet, other.txSet) + && Objects.equals(this.ledgerSeq, other.ledgerSeq) + && Objects.equals(this.scpValue, other.scpValue); + } + + @Override + public String toXdrBase64() throws IOException { + return Base64Factory.getInstance().encodeToString(toXdrByteArray()); + } + + @Override + public byte[] toXdrByteArray() throws IOException { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + XdrDataOutputStream xdrDataOutputStream = new XdrDataOutputStream(byteArrayOutputStream); + encode(xdrDataOutputStream); + return byteArrayOutputStream.toByteArray(); + } + + public static StoredDebugTransactionSet fromXdrBase64(String xdr) throws IOException { + byte[] bytes = Base64Factory.getInstance().decode(xdr); + return fromXdrByteArray(bytes); + } + + public static StoredDebugTransactionSet fromXdrByteArray(byte[] xdr) throws IOException { + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); + XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); + return decode(xdrDataInputStream); + } + + public static final class Builder { + private StoredTransactionSet txSet; + private Uint32 ledgerSeq; + private StellarValue scpValue; + + public Builder txSet(StoredTransactionSet txSet) { + this.txSet = txSet; + return this; + } + + public Builder ledgerSeq(Uint32 ledgerSeq) { + this.ledgerSeq = ledgerSeq; + return this; + } + + public Builder scpValue(StellarValue scpValue) { + this.scpValue = scpValue; + return this; + } + + public StoredDebugTransactionSet build() { + StoredDebugTransactionSet val = new StoredDebugTransactionSet(); + val.setTxSet(this.txSet); + val.setLedgerSeq(this.ledgerSeq); + val.setScpValue(this.scpValue); + return val; + } + } +} diff --git a/src/main/java/org/stellar/sdk/xdr/ExpirationEntry.java b/src/main/java/org/stellar/sdk/xdr/TTLEntry.java similarity index 54% rename from src/main/java/org/stellar/sdk/xdr/ExpirationEntry.java rename to src/main/java/org/stellar/sdk/xdr/TTLEntry.java index 4a34cd939..6d6f712d7 100644 --- a/src/main/java/org/stellar/sdk/xdr/ExpirationEntry.java +++ b/src/main/java/org/stellar/sdk/xdr/TTLEntry.java @@ -13,15 +13,15 @@ // === xdr source ============================================================ -// struct ExpirationEntry { -// // Hash of the LedgerKey that is associated with this ExpirationEntry +// struct TTLEntry { +// // Hash of the LedgerKey that is associated with this TTLEntry // Hash keyHash; -// uint32 expirationLedgerSeq; +// uint32 liveUntilLedgerSeq; // }; // =========================================================================== -public class ExpirationEntry implements XdrElement { - public ExpirationEntry() {} +public class TTLEntry implements XdrElement { + public TTLEntry() {} private Hash keyHash; @@ -33,47 +33,47 @@ public void setKeyHash(Hash value) { this.keyHash = value; } - private Uint32 expirationLedgerSeq; + private Uint32 liveUntilLedgerSeq; - public Uint32 getExpirationLedgerSeq() { - return this.expirationLedgerSeq; + public Uint32 getLiveUntilLedgerSeq() { + return this.liveUntilLedgerSeq; } - public void setExpirationLedgerSeq(Uint32 value) { - this.expirationLedgerSeq = value; + public void setLiveUntilLedgerSeq(Uint32 value) { + this.liveUntilLedgerSeq = value; } - public static void encode(XdrDataOutputStream stream, ExpirationEntry encodedExpirationEntry) + public static void encode(XdrDataOutputStream stream, TTLEntry encodedTTLEntry) throws IOException { - Hash.encode(stream, encodedExpirationEntry.keyHash); - Uint32.encode(stream, encodedExpirationEntry.expirationLedgerSeq); + Hash.encode(stream, encodedTTLEntry.keyHash); + Uint32.encode(stream, encodedTTLEntry.liveUntilLedgerSeq); } public void encode(XdrDataOutputStream stream) throws IOException { encode(stream, this); } - public static ExpirationEntry decode(XdrDataInputStream stream) throws IOException { - ExpirationEntry decodedExpirationEntry = new ExpirationEntry(); - decodedExpirationEntry.keyHash = Hash.decode(stream); - decodedExpirationEntry.expirationLedgerSeq = Uint32.decode(stream); - return decodedExpirationEntry; + public static TTLEntry decode(XdrDataInputStream stream) throws IOException { + TTLEntry decodedTTLEntry = new TTLEntry(); + decodedTTLEntry.keyHash = Hash.decode(stream); + decodedTTLEntry.liveUntilLedgerSeq = Uint32.decode(stream); + return decodedTTLEntry; } @Override public int hashCode() { - return Objects.hash(this.keyHash, this.expirationLedgerSeq); + return Objects.hash(this.keyHash, this.liveUntilLedgerSeq); } @Override public boolean equals(Object object) { - if (!(object instanceof ExpirationEntry)) { + if (!(object instanceof TTLEntry)) { return false; } - ExpirationEntry other = (ExpirationEntry) object; + TTLEntry other = (TTLEntry) object; return Objects.equals(this.keyHash, other.keyHash) - && Objects.equals(this.expirationLedgerSeq, other.expirationLedgerSeq); + && Objects.equals(this.liveUntilLedgerSeq, other.liveUntilLedgerSeq); } @Override @@ -89,12 +89,12 @@ public byte[] toXdrByteArray() throws IOException { return byteArrayOutputStream.toByteArray(); } - public static ExpirationEntry fromXdrBase64(String xdr) throws IOException { + public static TTLEntry fromXdrBase64(String xdr) throws IOException { byte[] bytes = Base64Factory.getInstance().decode(xdr); return fromXdrByteArray(bytes); } - public static ExpirationEntry fromXdrByteArray(byte[] xdr) throws IOException { + public static TTLEntry fromXdrByteArray(byte[] xdr) throws IOException { ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); return decode(xdrDataInputStream); @@ -102,22 +102,22 @@ public static ExpirationEntry fromXdrByteArray(byte[] xdr) throws IOException { public static final class Builder { private Hash keyHash; - private Uint32 expirationLedgerSeq; + private Uint32 liveUntilLedgerSeq; public Builder keyHash(Hash keyHash) { this.keyHash = keyHash; return this; } - public Builder expirationLedgerSeq(Uint32 expirationLedgerSeq) { - this.expirationLedgerSeq = expirationLedgerSeq; + public Builder liveUntilLedgerSeq(Uint32 liveUntilLedgerSeq) { + this.liveUntilLedgerSeq = liveUntilLedgerSeq; return this; } - public ExpirationEntry build() { - ExpirationEntry val = new ExpirationEntry(); + public TTLEntry build() { + TTLEntry val = new TTLEntry(); val.setKeyHash(this.keyHash); - val.setExpirationLedgerSeq(this.expirationLedgerSeq); + val.setLiveUntilLedgerSeq(this.liveUntilLedgerSeq); return val; } } diff --git a/src/test/java/org/stellar/sdk/scval/ScvContractInstanceTest.java b/src/test/java/org/stellar/sdk/scval/ScvContractInstanceTest.java index 94b30b302..7210d7e5b 100644 --- a/src/test/java/org/stellar/sdk/scval/ScvContractInstanceTest.java +++ b/src/test/java/org/stellar/sdk/scval/ScvContractInstanceTest.java @@ -16,7 +16,7 @@ public void testScvContractInstance() { new SCContractInstance.Builder() .executable( new ContractExecutable.Builder() - .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build()) .build(); diff --git a/xdr/Stellar-contract-config-setting.x b/xdr/Stellar-contract-config-setting.x index 9512f0c4d..b187a18c5 100644 --- a/xdr/Stellar-contract-config-setting.x +++ b/xdr/Stellar-contract-config-setting.x @@ -92,64 +92,54 @@ struct ConfigSettingContractBandwidthV0 enum ContractCostType { // Cost of running 1 wasm instruction WasmInsnExec = 0, - // Cost of growing wasm linear memory by 1 page - WasmMemAlloc = 1, - // Cost of allocating a chuck of host memory (in bytes) - HostMemAlloc = 2, - // Cost of copying a chuck of bytes into a pre-allocated host memory - HostMemCpy = 3, - // Cost of comparing two slices of host memory - HostMemCmp = 4, + // Cost of allocating a slice of memory (in bytes) + MemAlloc = 1, + // Cost of copying a slice of bytes into a pre-allocated memory + MemCpy = 2, + // Cost of comparing two slices of memory + MemCmp = 3, // Cost of a host function dispatch, not including the actual work done by // the function nor the cost of VM invocation machinary - DispatchHostFunction = 5, + DispatchHostFunction = 4, // Cost of visiting a host object from the host object storage. Exists to // make sure some baseline cost coverage, i.e. repeatly visiting objects // by the guest will always incur some charges. - VisitObject = 6, + VisitObject = 5, // Cost of serializing an xdr object to bytes - ValSer = 7, + ValSer = 6, // Cost of deserializing an xdr object from bytes - ValDeser = 8, + ValDeser = 7, // Cost of computing the sha256 hash from bytes - ComputeSha256Hash = 9, + ComputeSha256Hash = 8, // Cost of computing the ed25519 pubkey from bytes - ComputeEd25519PubKey = 10, - // Cost of accessing an entry in a Map. - MapEntry = 11, - // Cost of accessing an entry in a Vec - VecEntry = 12, + ComputeEd25519PubKey = 9, // Cost of verifying ed25519 signature of a payload. - VerifyEd25519Sig = 13, - // Cost of reading a slice of vm linear memory - VmMemRead = 14, - // Cost of writing to a slice of vm linear memory - VmMemWrite = 15, + VerifyEd25519Sig = 10, // Cost of instantiation a VM from wasm bytes code. - VmInstantiation = 16, + VmInstantiation = 11, // Cost of instantiation a VM from a cached state. - VmCachedInstantiation = 17, + VmCachedInstantiation = 12, // Cost of invoking a function on the VM. If the function is a host function, // additional cost will be covered by `DispatchHostFunction`. - InvokeVmFunction = 18, + InvokeVmFunction = 13, // Cost of computing a keccak256 hash from bytes. - ComputeKeccak256Hash = 19, - // Cost of computing an ECDSA secp256k1 pubkey from bytes. - ComputeEcdsaSecp256k1Key = 20, + ComputeKeccak256Hash = 14, // Cost of computing an ECDSA secp256k1 signature from bytes. - ComputeEcdsaSecp256k1Sig = 21, + ComputeEcdsaSecp256k1Sig = 15, // Cost of recovering an ECDSA secp256k1 key from a signature. - RecoverEcdsaSecp256k1Key = 22, + RecoverEcdsaSecp256k1Key = 16, // Cost of int256 addition (`+`) and subtraction (`-`) operations - Int256AddSub = 23, + Int256AddSub = 17, // Cost of int256 multiplication (`*`) operation - Int256Mul = 24, + Int256Mul = 18, // Cost of int256 division (`/`) operation - Int256Div = 25, + Int256Div = 19, // Cost of int256 power (`exp`) operation - Int256Pow = 26, + Int256Pow = 20, // Cost of int256 shift (`shl`, `shr`) operation - Int256Shift = 27 + Int256Shift = 21, + // Cost of drawing random bytes using a ChaCha20 PRNG + ChaCha20DrawBytes = 22 }; struct ContractCostParamEntry { @@ -160,17 +150,17 @@ struct ContractCostParamEntry { int64 linearTerm; }; -struct StateExpirationSettings { - uint32 maxEntryExpiration; - uint32 minTempEntryExpiration; - uint32 minPersistentEntryExpiration; +struct StateArchivalSettings { + uint32 maxEntryTTL; + uint32 minTemporaryTTL; + uint32 minPersistentTTL; // rent_fee = wfee_rate_average / rent_rate_denominator_for_type int64 persistentRentRateDenominator; int64 tempRentRateDenominator; - // max number of entries that emit expiration meta in a single ledger - uint32 maxEntriesToExpire; + // max number of entries that emit archival meta in a single ledger + uint32 maxEntriesToArchive; // Number of snapshots to use when calculating average BucketList size uint32 bucketListSizeWindowSampleSize; @@ -206,7 +196,7 @@ enum ConfigSettingID CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES = 7, CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES = 8, CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES = 9, - CONFIG_SETTING_STATE_EXPIRATION = 10, + CONFIG_SETTING_STATE_ARCHIVAL = 10, CONFIG_SETTING_CONTRACT_EXECUTION_LANES = 11, CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW = 12, CONFIG_SETTING_EVICTION_ITERATOR = 13 @@ -234,8 +224,8 @@ case CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES: uint32 contractDataKeySizeBytes; case CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: uint32 contractDataEntrySizeBytes; -case CONFIG_SETTING_STATE_EXPIRATION: - StateExpirationSettings stateExpirationSettings; +case CONFIG_SETTING_STATE_ARCHIVAL: + StateArchivalSettings stateArchivalSettings; case CONFIG_SETTING_CONTRACT_EXECUTION_LANES: ConfigSettingContractExecutionLanesV0 contractExecutionLanes; case CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: diff --git a/xdr/Stellar-contract.x b/xdr/Stellar-contract.x index 7c7469c7e..511300562 100644 --- a/xdr/Stellar-contract.x +++ b/xdr/Stellar-contract.x @@ -165,14 +165,14 @@ struct Int256Parts { enum ContractExecutableType { CONTRACT_EXECUTABLE_WASM = 0, - CONTRACT_EXECUTABLE_TOKEN = 1 + CONTRACT_EXECUTABLE_STELLAR_ASSET = 1 }; union ContractExecutable switch (ContractExecutableType type) { case CONTRACT_EXECUTABLE_WASM: Hash wasm_hash; -case CONTRACT_EXECUTABLE_TOKEN: +case CONTRACT_EXECUTABLE_STELLAR_ASSET: void; }; diff --git a/xdr/Stellar-internal.x b/xdr/Stellar-internal.x index 73684db7a..02f1b81e8 100644 --- a/xdr/Stellar-internal.x +++ b/xdr/Stellar-internal.x @@ -17,6 +17,13 @@ case 1: GeneralizedTransactionSet generalizedTxSet; }; +struct StoredDebugTransactionSet +{ + StoredTransactionSet txSet; + uint32 ledgerSeq; + StellarValue scpValue; +}; + struct PersistedSCPStateV0 { SCPEnvelope scpEnvelopes<>; diff --git a/xdr/Stellar-ledger-entries.x b/xdr/Stellar-ledger-entries.x index f06648400..8a8784e2b 100644 --- a/xdr/Stellar-ledger-entries.x +++ b/xdr/Stellar-ledger-entries.x @@ -101,7 +101,7 @@ enum LedgerEntryType CONTRACT_DATA = 6, CONTRACT_CODE = 7, CONFIG_SETTING = 8, - EXPIRATION = 9 + TTL = 9 }; struct Signer @@ -515,10 +515,10 @@ struct ContractCodeEntry { opaque code<>; }; -struct ExpirationEntry { - // Hash of the LedgerKey that is associated with this ExpirationEntry +struct TTLEntry { + // Hash of the LedgerKey that is associated with this TTLEntry Hash keyHash; - uint32 expirationLedgerSeq; + uint32 liveUntilLedgerSeq; }; struct LedgerEntryExtensionV1 @@ -557,8 +557,8 @@ struct LedgerEntry ContractCodeEntry contractCode; case CONFIG_SETTING: ConfigSettingEntry configSetting; - case EXPIRATION: - ExpirationEntry expiration; + case TTL: + TTLEntry ttl; } data; @@ -630,12 +630,12 @@ case CONFIG_SETTING: { ConfigSettingID configSettingID; } configSetting; -case EXPIRATION: +case TTL: struct { - // Hash of the LedgerKey that is associated with this ExpirationEntry + // Hash of the LedgerKey that is associated with this TTLEntry Hash keyHash; - } expiration; + } ttl; }; // list of all envelope types used in the application diff --git a/xdr/Stellar-ledger.x b/xdr/Stellar-ledger.x index a1bbac4b6..b18a3a0d5 100644 --- a/xdr/Stellar-ledger.x +++ b/xdr/Stellar-ledger.x @@ -486,26 +486,8 @@ struct LedgerCloseMetaV0 struct LedgerCloseMetaV1 { - LedgerHeaderHistoryEntry ledgerHeader; - - GeneralizedTransactionSet txSet; - - // NB: transactions are sorted in apply order here - // fees for all transactions are processed first - // followed by applying transactions - TransactionResultMeta txProcessing<>; - - // upgrades are applied last - UpgradeEntryMeta upgradesProcessing<>; - - // other misc information attached to the ledger close - SCPHistoryEntry scpInfo<>; -}; - -struct LedgerCloseMetaV2 -{ - // We forgot to add an ExtensionPoint in v1 but at least - // we can add one now in v2. + // We forgot to add an ExtensionPoint in v0 but at least + // we can add one now in v1. ExtensionPoint ext; LedgerHeaderHistoryEntry ledgerHeader; @@ -527,10 +509,10 @@ struct LedgerCloseMetaV2 // systems calculating storage fees correctly. uint64 totalByteSizeOfBucketList; - // Expired temp keys that are being evicted at this ledger. + // Temp keys that are being evicted at this ledger. LedgerKey evictedTemporaryLedgerKeys<>; - // Expired restorable ledger entries that are being + // Archived restorable ledger entries that are being // evicted at this ledger. LedgerEntry evictedPersistentLedgerEntries<>; }; @@ -541,7 +523,5 @@ case 0: LedgerCloseMetaV0 v0; case 1: LedgerCloseMetaV1 v1; -case 2: - LedgerCloseMetaV2 v2; }; } diff --git a/xdr/Stellar-transaction.x b/xdr/Stellar-transaction.x index 2e3c22b31..c7f0f5e27 100644 --- a/xdr/Stellar-transaction.x +++ b/xdr/Stellar-transaction.x @@ -63,7 +63,7 @@ enum OperationType LIQUIDITY_POOL_DEPOSIT = 22, LIQUIDITY_POOL_WITHDRAW = 23, INVOKE_HOST_FUNCTION = 24, - BUMP_FOOTPRINT_EXPIRATION = 25, + EXTEND_FOOTPRINT_TTL = 25, RESTORE_FOOTPRINT = 26 }; @@ -585,19 +585,19 @@ struct InvokeHostFunctionOp SorobanAuthorizationEntry auth<>; }; -/* Bump the expiration ledger of the entries specified in the readOnly footprint - so they'll expire at least ledgersToExpire ledgers from lcl. +/* Extend the TTL of the entries specified in the readOnly footprint + so they will live at least extendTo ledgers from lcl. Threshold: med - Result: BumpFootprintExpirationResult + Result: ExtendFootprintTTLResult */ -struct BumpFootprintExpirationOp +struct ExtendFootprintTTLOp { ExtensionPoint ext; - uint32 ledgersToExpire; + uint32 extendTo; }; -/* Restore the expired or evicted entries specified in the readWrite footprint. +/* Restore the archived entries specified in the readWrite footprint. Threshold: med Result: RestoreFootprintOp @@ -667,8 +667,8 @@ struct Operation LiquidityPoolWithdrawOp liquidityPoolWithdrawOp; case INVOKE_HOST_FUNCTION: InvokeHostFunctionOp invokeHostFunctionOp; - case BUMP_FOOTPRINT_EXPIRATION: - BumpFootprintExpirationOp bumpFootprintExpirationOp; + case EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLOp extendFootprintTTLOp; case RESTORE_FOOTPRINT: RestoreFootprintOp restoreFootprintOp; } @@ -821,8 +821,16 @@ struct SorobanTransactionData { ExtensionPoint ext; SorobanResources resources; - // Portion of transaction `fee` allocated to refundable fees. - int64 refundableFee; + // Amount of the transaction `fee` allocated to the Soroban resource fees. + // The fraction of `resourceFee` corresponding to `resources` specified + // above is *not* refundable (i.e. fees for instructions, ledger I/O), as + // well as fees for the transaction size. + // The remaining part of the fee is refundable and the charged value is + // based on the actual consumption of refundable resources (events, ledger + // rent bumps). + // The `inclusionFee` used for prioritization of the transaction is defined + // as `tx.fee - resourceFee`. + int64 resourceFee; }; // TransactionV0 is a transaction with the AccountID discriminant stripped off, @@ -1789,7 +1797,7 @@ enum InvokeHostFunctionResultCode INVOKE_HOST_FUNCTION_MALFORMED = -1, INVOKE_HOST_FUNCTION_TRAPPED = -2, INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED = -3, - INVOKE_HOST_FUNCTION_ENTRY_EXPIRED = -4, + INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED = -4, INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE = -5 }; @@ -1800,29 +1808,29 @@ case INVOKE_HOST_FUNCTION_SUCCESS: case INVOKE_HOST_FUNCTION_MALFORMED: case INVOKE_HOST_FUNCTION_TRAPPED: case INVOKE_HOST_FUNCTION_RESOURCE_LIMIT_EXCEEDED: -case INVOKE_HOST_FUNCTION_ENTRY_EXPIRED: +case INVOKE_HOST_FUNCTION_ENTRY_ARCHIVED: case INVOKE_HOST_FUNCTION_INSUFFICIENT_REFUNDABLE_FEE: void; }; -enum BumpFootprintExpirationResultCode +enum ExtendFootprintTTLResultCode { // codes considered as "success" for the operation - BUMP_FOOTPRINT_EXPIRATION_SUCCESS = 0, + EXTEND_FOOTPRINT_TTL_SUCCESS = 0, // codes considered as "failure" for the operation - BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1, - BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2, - BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3 + EXTEND_FOOTPRINT_TTL_MALFORMED = -1, + EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED = -2, + EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE = -3 }; -union BumpFootprintExpirationResult switch (BumpFootprintExpirationResultCode code) +union ExtendFootprintTTLResult switch (ExtendFootprintTTLResultCode code) { -case BUMP_FOOTPRINT_EXPIRATION_SUCCESS: +case EXTEND_FOOTPRINT_TTL_SUCCESS: void; -case BUMP_FOOTPRINT_EXPIRATION_MALFORMED: -case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED: -case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE: +case EXTEND_FOOTPRINT_TTL_MALFORMED: +case EXTEND_FOOTPRINT_TTL_RESOURCE_LIMIT_EXCEEDED: +case EXTEND_FOOTPRINT_TTL_INSUFFICIENT_REFUNDABLE_FEE: void; }; @@ -1915,8 +1923,8 @@ case opINNER: LiquidityPoolWithdrawResult liquidityPoolWithdrawResult; case INVOKE_HOST_FUNCTION: InvokeHostFunctionResult invokeHostFunctionResult; - case BUMP_FOOTPRINT_EXPIRATION: - BumpFootprintExpirationResult bumpFootprintExpirationResult; + case EXTEND_FOOTPRINT_TTL: + ExtendFootprintTTLResult extendFootprintTTLResult; case RESTORE_FOOTPRINT: RestoreFootprintResult restoreFootprintResult; } From 8fbc1c972f84bf282be0153bd37ad649506374e2 Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Tue, 24 Oct 2023 10:29:55 +0800 Subject: [PATCH 2/5] Updating the SDK to the stable Protocol 20 release --- .../javastellarsdkdemoapp/MainActivity.kt | 4 +- ....java => ExtendFootprintTTLOperation.java} | 41 +++--- .../sdk/InvokeHostFunctionOperation.java | 8 +- src/main/java/org/stellar/sdk/Operation.java | 4 +- .../org/stellar/sdk/SorobanDataBuilder.java | 14 +- .../java/org/stellar/sdk/SorobanServer.java | 35 +++-- .../java/org/stellar/sdk/Transaction.java | 2 +- .../sdk/responses/OperationDeserializer.java | 4 +- ... ExtendFootprintTTLOperationResponse.java} | 18 +-- .../BumpFootprintExpirationOperationTest.java | 121 ------------------ .../sdk/ExtendFootprintTTLOperationTest.java | 99 ++++++++++++++ .../sdk/InvokeHostFunctionOperationTest.java | 13 +- .../stellar/sdk/SorobanDataBuilderTest.java | 6 +- .../org/stellar/sdk/SorobanServerTest.java | 4 +- .../stellar/sdk/TransactionBuilderTest.java | 6 +- .../java/org/stellar/sdk/TransactionTest.java | 10 +- .../responses/OperationDeserializerTest.java | 12 +- 17 files changed, 189 insertions(+), 212 deletions(-) rename src/main/java/org/stellar/sdk/{BumpFootprintExpirationOperation.java => ExtendFootprintTTLOperation.java} (51%) rename src/main/java/org/stellar/sdk/responses/operations/{BumpFootprintExpirationOperationResponse.java => ExtendFootprintTTLOperationResponse.java} (57%) delete mode 100644 src/test/java/org/stellar/sdk/BumpFootprintExpirationOperationTest.java create mode 100644 src/test/java/org/stellar/sdk/ExtendFootprintTTLOperationTest.java diff --git a/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt b/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt index c5bf30bc5..bb3947ddf 100644 --- a/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt +++ b/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt @@ -189,7 +189,7 @@ private fun testSDK(): String { .instructions(Uint32(XdrUnsignedInteger(34567))) .build() ) - .refundableFee(Int64(100L)) + .resourceFee(Int64(100L)) .ext(ExtensionPoint.Builder().discriminant(0).build()) .build() val sorobanDataString = sorobanData.toXdrBase64() @@ -213,7 +213,7 @@ private fun testSDK(): String { ) .executable( ContractExecutable.Builder() - .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build() ) .build() diff --git a/src/main/java/org/stellar/sdk/BumpFootprintExpirationOperation.java b/src/main/java/org/stellar/sdk/ExtendFootprintTTLOperation.java similarity index 51% rename from src/main/java/org/stellar/sdk/BumpFootprintExpirationOperation.java rename to src/main/java/org/stellar/sdk/ExtendFootprintTTLOperation.java index 489f9a85c..16981ff62 100644 --- a/src/main/java/org/stellar/sdk/BumpFootprintExpirationOperation.java +++ b/src/main/java/org/stellar/sdk/ExtendFootprintTTLOperation.java @@ -4,7 +4,7 @@ import lombok.NonNull; import lombok.Value; import lombok.experimental.SuperBuilder; -import org.stellar.sdk.xdr.BumpFootprintExpirationOp; +import org.stellar.sdk.xdr.ExtendFootprintTTLOp; import org.stellar.sdk.xdr.ExtensionPoint; import org.stellar.sdk.xdr.OperationType; import org.stellar.sdk.xdr.Uint32; @@ -13,7 +13,7 @@ /** * Represents BumpFootprintExpiration operation. + * target="_blank">ExtendFootprintTTL operation. * *

Bump the expiration of a footprint (read and written ledger keys). * @@ -23,49 +23,48 @@ @EqualsAndHashCode(callSuper = true) @SuperBuilder(toBuilder = true) @Value -public class BumpFootprintExpirationOperation extends Operation { +public class ExtendFootprintTTLOperation extends Operation { /** * the number of ledgers past the LCL (last closed ledger) by which to extend the validity of the * ledger keys in this transaction */ - @NonNull Long ledgersToExpire; + @NonNull Long extendTo; /** - * Constructs a new BumpFootprintExpirationOperation object from the XDR representation of the - * {@link BumpFootprintExpirationOperation}. + * Constructs a new ExtendFootprintTTLOperation object from the XDR representation of the {@link + * ExtendFootprintTTLOperation}. * - * @param op the XDR representation of the {@link BumpFootprintExpirationOperation}. + * @param op the XDR representation of the {@link ExtendFootprintTTLOperation}. */ - public static BumpFootprintExpirationOperation fromXdr(BumpFootprintExpirationOp op) { - return BumpFootprintExpirationOperation.builder() - .ledgersToExpire(op.getLedgersToExpire().getUint32().getNumber()) + public static ExtendFootprintTTLOperation fromXdr(ExtendFootprintTTLOp op) { + return ExtendFootprintTTLOperation.builder() + .extendTo(op.getExtendTo().getUint32().getNumber()) .build(); } @Override org.stellar.sdk.xdr.Operation.OperationBody toOperationBody(AccountConverter accountConverter) { - BumpFootprintExpirationOp op = new BumpFootprintExpirationOp(); + ExtendFootprintTTLOp op = new ExtendFootprintTTLOp(); op.setExt(new ExtensionPoint.Builder().discriminant(0).build()); - op.setLedgersToExpire(new Uint32(new XdrUnsignedInteger(ledgersToExpire))); + op.setExtendTo(new Uint32(new XdrUnsignedInteger(extendTo))); org.stellar.sdk.xdr.Operation.OperationBody body = new org.stellar.sdk.xdr.Operation.OperationBody(); - body.setDiscriminant(OperationType.BUMP_FOOTPRINT_EXPIRATION); - body.setBumpFootprintExpirationOp(op); + body.setDiscriminant(OperationType.EXTEND_FOOTPRINT_TTL); + body.setExtendFootprintTTLOp(op); return body; } /** Customizing builder methods. Rest of the builder code will be auto generated by Lombok. */ - public abstract static class BumpFootprintExpirationOperationBuilder< - C extends BumpFootprintExpirationOperation, - B extends BumpFootprintExpirationOperationBuilder> + public abstract static class ExtendFootprintTTLOperationBuilder< + C extends ExtendFootprintTTLOperation, B extends ExtendFootprintTTLOperationBuilder> extends OperationBuilder { - public B ledgersToExpire(Long ledgersToExpire) { - if (ledgersToExpire <= 0 || ledgersToExpire > 0xFFFFFFFFL) { - throw new IllegalArgumentException("ledgersToExpire isn't a ledger quantity (uint32)"); + public B extendTo(Long extendTo) { + if (extendTo <= 0 || extendTo > 0xFFFFFFFFL) { + throw new IllegalArgumentException("extendTo isn't a ledger quantity (uint32)"); } - this.ledgersToExpire = ledgersToExpire; + this.extendTo = extendTo; return self(); } } diff --git a/src/main/java/org/stellar/sdk/InvokeHostFunctionOperation.java b/src/main/java/org/stellar/sdk/InvokeHostFunctionOperation.java index 3ec20dd68..e0bf62ad1 100644 --- a/src/main/java/org/stellar/sdk/InvokeHostFunctionOperation.java +++ b/src/main/java/org/stellar/sdk/InvokeHostFunctionOperation.java @@ -153,7 +153,7 @@ public static InvokeHostFunctionOperation fromXdr(InvokeHostFunctionOp op) { * @param asset The classic asset to wrap. * @return {@link InvokeHostFunctionOperationBuilder} */ - public static InvokeHostFunctionOperationBuilder createTokenContractOperationBuilder( + public static InvokeHostFunctionOperationBuilder createStellarAssetContractOperationBuilder( Asset asset) { CreateContractArgs createContractArgs = new CreateContractArgs.Builder() @@ -164,7 +164,7 @@ public static InvokeHostFunctionOperation fromXdr(InvokeHostFunctionOp op) { .build()) .executable( new ContractExecutable.Builder() - .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build()) .build(); HostFunction hostFunction = @@ -185,7 +185,7 @@ public static InvokeHostFunctionOperation fromXdr(InvokeHostFunctionOp op) { * generated. * @return {@link InvokeHostFunctionOperationBuilder} */ - public static InvokeHostFunctionOperationBuilder createTokenContractOperationBuilder( + public static InvokeHostFunctionOperationBuilder createStellarAssetContractOperationBuilder( Address address, @Nullable byte[] salt) { if (salt == null) { salt = new byte[32]; @@ -207,7 +207,7 @@ public static InvokeHostFunctionOperation fromXdr(InvokeHostFunctionOp op) { .build()) .executable( new ContractExecutable.Builder() - .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build()) .build(); HostFunction hostFunction = diff --git a/src/main/java/org/stellar/sdk/Operation.java b/src/main/java/org/stellar/sdk/Operation.java index 840c7a25d..541202b4f 100644 --- a/src/main/java/org/stellar/sdk/Operation.java +++ b/src/main/java/org/stellar/sdk/Operation.java @@ -199,8 +199,8 @@ public static Operation fromXdr( case INVOKE_HOST_FUNCTION: operation = InvokeHostFunctionOperation.fromXdr(body.getInvokeHostFunctionOp()); break; - case BUMP_FOOTPRINT_EXPIRATION: - operation = BumpFootprintExpirationOperation.fromXdr(body.getBumpFootprintExpirationOp()); + case EXTEND_FOOTPRINT_TTL: + operation = ExtendFootprintTTLOperation.fromXdr(body.getExtendFootprintTTLOp()); break; case RESTORE_FOOTPRINT: operation = RestoreFootprintOperation.fromXdr(body.getRestoreFootprintOp()); diff --git a/src/main/java/org/stellar/sdk/SorobanDataBuilder.java b/src/main/java/org/stellar/sdk/SorobanDataBuilder.java index fea84ec2d..906b3684e 100644 --- a/src/main/java/org/stellar/sdk/SorobanDataBuilder.java +++ b/src/main/java/org/stellar/sdk/SorobanDataBuilder.java @@ -19,8 +19,8 @@ * Supports building {@link SorobanTransactionData} structures with various items set to specific * values. * - *

This is recommended for when you are building {@link BumpFootprintExpirationOperation} and - * {@link RestoreFootprintOperation} operations to avoid (re)building the entire data structure from + *

This is recommended for when you are building {@link ExtendFootprintTTLOperation} and {@link + * RestoreFootprintOperation} operations to avoid (re)building the entire data structure from * scratch. */ public class SorobanDataBuilder { @@ -41,7 +41,7 @@ public SorobanDataBuilder() { .readBytes(new Uint32(new XdrUnsignedInteger(0))) .writeBytes(new Uint32(new XdrUnsignedInteger(0))) .build()) - .refundableFee(new Int64(0L)) + .resourceFee(new Int64(0L)) .ext(new ExtensionPoint.Builder().discriminant(0).build()) .build(); } @@ -73,13 +73,13 @@ public SorobanDataBuilder(SorobanTransactionData sorobanData) { } /** - * Sets the "refundable" fee portion of the Soroban data. + * Sets the "resource" fee portion of the Soroban data. * - * @param fee the refundable fee to set (int64) + * @param fee the resource fee to set (int64) * @return this builder instance */ - public SorobanDataBuilder setRefundableFee(long fee) { - data.setRefundableFee(new Int64(fee)); + public SorobanDataBuilder setResourceFee(long fee) { + data.setResourceFee(new Int64(fee)); return this; } diff --git a/src/main/java/org/stellar/sdk/SorobanServer.java b/src/main/java/org/stellar/sdk/SorobanServer.java index eab3a03c6..98f884677 100644 --- a/src/main/java/org/stellar/sdk/SorobanServer.java +++ b/src/main/java/org/stellar/sdk/SorobanServer.java @@ -313,9 +313,8 @@ public GetLatestLedgerResponse getLatestLedger() throws IOException, SorobanRpcE * @see simulateTransaction documentation * @param transaction The transaction to simulate. It should include exactly one operation, which - * must be one of {@link InvokeHostFunctionOperation}, {@link - * BumpFootprintExpirationOperation}, or {@link RestoreFootprintOperation}. Any provided - * footprint will be ignored. + * must be one of {@link InvokeHostFunctionOperation}, {@link ExtendFootprintTTLOperation}, or + * {@link RestoreFootprintOperation}. Any provided footprint will be ignored. * @return A {@link SimulateTransactionResponse} object containing the cost, footprint, * result/auth requirements (if applicable), and error of the transaction. * @throws IOException If the request could not be executed due to cancellation, a connectivity @@ -349,14 +348,13 @@ public SimulateTransactionResponse simulateTransaction(Transaction transaction) * to inspect estimated fees for a given transaction in detail first, if that is of importance. * * @param transaction The transaction to prepare. It should include exactly one operation, which - * must be one of {@link InvokeHostFunctionOperation}, {@link - * BumpFootprintExpirationOperation}, or {@link RestoreFootprintOperation}. Any provided - * footprint will be ignored. You can use {@link Transaction#isSorobanTransaction()} to check - * if a transaction is a Soroban transaction. Any provided footprint will be overwritten. - * However, if your operation has existing auth entries, they will be preferred over ALL auth - * entries from the simulation. In other words, if you include auth entries, you don't care - * about the auth returned from the simulation. Other fields (footprint, etc.) will be filled - * as normal. + * must be one of {@link InvokeHostFunctionOperation}, {@link ExtendFootprintTTLOperation}, or + * {@link RestoreFootprintOperation}. Any provided footprint will be ignored. You can use + * {@link Transaction#isSorobanTransaction()} to check if a transaction is a Soroban + * transaction. Any provided footprint will be overwritten. However, if your operation has + * existing auth entries, they will be preferred over ALL auth entries from the simulation. In + * other words, if you include auth entries, you don't care about the auth returned from the + * simulation. Other fields (footprint, etc.) will be filled as normal. * @return Returns a copy of the {@link Transaction}, with the expected authorizations (in the * case of invocation) and ledger footprint added. The transaction fee will also automatically * be padded with the contract's minimum resource fees discovered from the simulation. @@ -384,14 +382,13 @@ public Transaction prepareTransaction(Transaction transaction) * interaction with user to confirm it is acceptable. * * @param transaction The transaction to prepare. It should include exactly one operation, which - * must be one of {@link InvokeHostFunctionOperation}, {@link - * BumpFootprintExpirationOperation}, or {@link RestoreFootprintOperation}. Any provided - * footprint will be ignored. You can use {@link Transaction#isSorobanTransaction()} to check - * if a transaction is a Soroban transaction. Any provided footprint will be overwritten. - * However, if your operation has existing auth entries, they will be preferred over ALL auth - * entries from the simulation. In other words, if you include auth entries, you don't care - * about the auth returned from the simulation. Other fields (footprint, etc.) will be filled - * as normal. + * must be one of {@link InvokeHostFunctionOperation}, {@link ExtendFootprintTTLOperation}, or + * {@link RestoreFootprintOperation}. Any provided footprint will be ignored. You can use + * {@link Transaction#isSorobanTransaction()} to check if a transaction is a Soroban + * transaction. Any provided footprint will be overwritten. However, if your operation has + * existing auth entries, they will be preferred over ALL auth entries from the simulation. In + * other words, if you include auth entries, you don't care about the auth returned from the + * simulation. Other fields (footprint, etc.) will be filled as normal. * @param simulateTransactionResponse The {@link SimulateTransactionResponse} to use for preparing * the transaction. * @return Returns a copy of the {@link Transaction}, with the expected authorizations (in the diff --git a/src/main/java/org/stellar/sdk/Transaction.java b/src/main/java/org/stellar/sdk/Transaction.java index 827cb7e4a..f60cb7107 100644 --- a/src/main/java/org/stellar/sdk/Transaction.java +++ b/src/main/java/org/stellar/sdk/Transaction.java @@ -402,7 +402,7 @@ public boolean isSorobanTransaction() { Operation op = mOperations[0]; return op instanceof InvokeHostFunctionOperation - || op instanceof BumpFootprintExpirationOperation + || op instanceof ExtendFootprintTTLOperation || op instanceof RestoreFootprintOperation; } } diff --git a/src/main/java/org/stellar/sdk/responses/OperationDeserializer.java b/src/main/java/org/stellar/sdk/responses/OperationDeserializer.java index 42e48c2bc..3d644acec 100644 --- a/src/main/java/org/stellar/sdk/responses/OperationDeserializer.java +++ b/src/main/java/org/stellar/sdk/responses/OperationDeserializer.java @@ -87,8 +87,8 @@ public OperationResponse deserialize( return gson.fromJson(json, LiquidityPoolWithdrawOperationResponse.class); case INVOKE_HOST_FUNCTION: return gson.fromJson(json, InvokeHostFunctionOperationResponse.class); - case BUMP_FOOTPRINT_EXPIRATION: - return gson.fromJson(json, BumpFootprintExpirationOperationResponse.class); + case EXTEND_FOOTPRINT_TTL: + return gson.fromJson(json, ExtendFootprintTTLOperationResponse.class); case RESTORE_FOOTPRINT: return gson.fromJson(json, RestoreFootprintOperationResponse.class); default: diff --git a/src/main/java/org/stellar/sdk/responses/operations/BumpFootprintExpirationOperationResponse.java b/src/main/java/org/stellar/sdk/responses/operations/ExtendFootprintTTLOperationResponse.java similarity index 57% rename from src/main/java/org/stellar/sdk/responses/operations/BumpFootprintExpirationOperationResponse.java rename to src/main/java/org/stellar/sdk/responses/operations/ExtendFootprintTTLOperationResponse.java index 1e23f0ac4..e00dec404 100644 --- a/src/main/java/org/stellar/sdk/responses/operations/BumpFootprintExpirationOperationResponse.java +++ b/src/main/java/org/stellar/sdk/responses/operations/ExtendFootprintTTLOperationResponse.java @@ -3,7 +3,9 @@ import com.google.gson.annotations.SerializedName; /** - * Represents BumpFootprintExpiration operation response. + * Represents ExtendFootprintTTL operation response. + * + *

TODO: update link * * @see Horizon @@ -13,15 +15,15 @@ * @see org.stellar.sdk.requests.OperationsRequestBuilder * @see org.stellar.sdk.Server#operations() */ -public class BumpFootprintExpirationOperationResponse extends OperationResponse { - @SerializedName("ledgers_to_expire") - private final Long ledgersToExpire; +public class ExtendFootprintTTLOperationResponse extends OperationResponse { + @SerializedName("extend_to") + private final Long extendTo; - public BumpFootprintExpirationOperationResponse(Long ledgersToExpire) { - this.ledgersToExpire = ledgersToExpire; + public ExtendFootprintTTLOperationResponse(Long extendTo) { + this.extendTo = extendTo; } - public Long getLedgersToExpire() { - return ledgersToExpire; + public Long getExtendTo() { + return extendTo; } } diff --git a/src/test/java/org/stellar/sdk/BumpFootprintExpirationOperationTest.java b/src/test/java/org/stellar/sdk/BumpFootprintExpirationOperationTest.java deleted file mode 100644 index 1319103f9..000000000 --- a/src/test/java/org/stellar/sdk/BumpFootprintExpirationOperationTest.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.stellar.sdk; - -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertNull; - -import org.junit.Assert; -import org.junit.Test; - -public class BumpFootprintExpirationOperationTest { - @Test - public void testBuilderWithSource() { - String source = "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW"; - BumpFootprintExpirationOperation op = - BumpFootprintExpirationOperation.builder() - .ledgersToExpire(123L) - .sourceAccount(source) - .build(); - assertEquals(Long.valueOf(123), op.getLedgersToExpire()); - assertEquals(source, op.getSourceAccount()); - String expectXdr = "AAAAAQAAAAAk4TTtavBWsGnEN3KxHw4Ohwi22ZJHWi8hlamN5pm0TgAAABkAAAAAAAAAew=="; - assertEquals(expectXdr, op.toXdrBase64()); - } - - @Test - public void testBuilderWithoutSource() { - BumpFootprintExpirationOperation op = - BumpFootprintExpirationOperation.builder().ledgersToExpire(123L).build(); - assertEquals(Long.valueOf(123), op.getLedgersToExpire()); - assertNull(op.getSourceAccount()); - String expectXdr = "AAAAAAAAABkAAAAAAAAAew=="; - assertEquals(expectXdr, op.toXdrBase64()); - } - - @Test - public void testFromXdr() { - String source = "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW"; - BumpFootprintExpirationOperation originOp = - BumpFootprintExpirationOperation.builder() - .ledgersToExpire(123L) - .sourceAccount(source) - .build(); - org.stellar.sdk.xdr.Operation xdrObject = originOp.toXdr(); - Operation restartOp = Operation.fromXdr(xdrObject); - Assert.assertEquals(restartOp, originOp); - } - - @Test - public void testEquals() { - String source = "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW"; - BumpFootprintExpirationOperation operation1 = - BumpFootprintExpirationOperation.builder() - .ledgersToExpire(123L) - .sourceAccount(source) - .build(); - BumpFootprintExpirationOperation operation2 = - BumpFootprintExpirationOperation.builder() - .ledgersToExpire(123L) - .sourceAccount(source) - .build(); - assertEquals(operation1, operation2); - } - - @Test - public void testNotEquals() { - String source = "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW"; - BumpFootprintExpirationOperation operation1 = - BumpFootprintExpirationOperation.builder() - .ledgersToExpire(123L) - .sourceAccount(source) - .build(); - BumpFootprintExpirationOperation operation2 = - BumpFootprintExpirationOperation.builder() - .ledgersToExpire(124L) - .sourceAccount(source) - .build(); - Assert.assertNotEquals(operation1, operation2); - } - - @Test - public void testNotEqualsSource() { - String source = "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW"; - BumpFootprintExpirationOperation operation1 = - BumpFootprintExpirationOperation.builder() - .ledgersToExpire(123L) - .sourceAccount(source) - .build(); - BumpFootprintExpirationOperation operation2 = - BumpFootprintExpirationOperation.builder().ledgersToExpire(123L).build(); - Assert.assertNotEquals(operation1, operation2); - } - - @Test - public void testLedgersToExpireIsInvalidThrowsLessThanZero() { - try { - BumpFootprintExpirationOperation.builder().ledgersToExpire(-1L).build(); - Assert.fail(); - } catch (IllegalArgumentException e) { - Assert.assertEquals("ledgersToExpire isn't a ledger quantity (uint32)", e.getMessage()); - } - } - - @Test - public void testLedgersToExpireIsInvalidThrowsGreatThanMaxUint32() { - try { - BumpFootprintExpirationOperation.builder().ledgersToExpire(4294967296L).build(); - Assert.fail(); - } catch (IllegalArgumentException e) { - Assert.assertEquals("ledgersToExpire isn't a ledger quantity (uint32)", e.getMessage()); - } - } - - @Test - public void testLedgersToExpireIsNullThrows() { - try { - BumpFootprintExpirationOperation.builder().build(); - Assert.fail(); - } catch (NullPointerException e) { - Assert.assertEquals("ledgersToExpire is marked non-null but is null", e.getMessage()); - } - } -} diff --git a/src/test/java/org/stellar/sdk/ExtendFootprintTTLOperationTest.java b/src/test/java/org/stellar/sdk/ExtendFootprintTTLOperationTest.java new file mode 100644 index 000000000..cf61993e3 --- /dev/null +++ b/src/test/java/org/stellar/sdk/ExtendFootprintTTLOperationTest.java @@ -0,0 +1,99 @@ +package org.stellar.sdk; + +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertNull; + +import org.junit.Assert; +import org.junit.Test; + +public class ExtendFootprintTTLOperationTest { + @Test + public void testBuilderWithSource() { + String source = "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW"; + ExtendFootprintTTLOperation op = + ExtendFootprintTTLOperation.builder().extendTo(123L).sourceAccount(source).build(); + assertEquals(Long.valueOf(123), op.getExtendTo()); + assertEquals(source, op.getSourceAccount()); + String expectXdr = "AAAAAQAAAAAk4TTtavBWsGnEN3KxHw4Ohwi22ZJHWi8hlamN5pm0TgAAABkAAAAAAAAAew=="; + assertEquals(expectXdr, op.toXdrBase64()); + } + + @Test + public void testBuilderWithoutSource() { + ExtendFootprintTTLOperation op = ExtendFootprintTTLOperation.builder().extendTo(123L).build(); + assertEquals(Long.valueOf(123), op.getExtendTo()); + assertNull(op.getSourceAccount()); + String expectXdr = "AAAAAAAAABkAAAAAAAAAew=="; + assertEquals(expectXdr, op.toXdrBase64()); + } + + @Test + public void testFromXdr() { + String source = "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW"; + ExtendFootprintTTLOperation originOp = + ExtendFootprintTTLOperation.builder().extendTo(123L).sourceAccount(source).build(); + org.stellar.sdk.xdr.Operation xdrObject = originOp.toXdr(); + Operation restartOp = Operation.fromXdr(xdrObject); + Assert.assertEquals(restartOp, originOp); + } + + @Test + public void testEquals() { + String source = "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW"; + ExtendFootprintTTLOperation operation1 = + ExtendFootprintTTLOperation.builder().extendTo(123L).sourceAccount(source).build(); + ExtendFootprintTTLOperation operation2 = + ExtendFootprintTTLOperation.builder().extendTo(123L).sourceAccount(source).build(); + assertEquals(operation1, operation2); + } + + @Test + public void testNotEquals() { + String source = "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW"; + ExtendFootprintTTLOperation operation1 = + ExtendFootprintTTLOperation.builder().extendTo(123L).sourceAccount(source).build(); + ExtendFootprintTTLOperation operation2 = + ExtendFootprintTTLOperation.builder().extendTo(124L).sourceAccount(source).build(); + Assert.assertNotEquals(operation1, operation2); + } + + @Test + public void testNotEqualsSource() { + String source = "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW"; + ExtendFootprintTTLOperation operation1 = + ExtendFootprintTTLOperation.builder().extendTo(123L).sourceAccount(source).build(); + ExtendFootprintTTLOperation operation2 = + ExtendFootprintTTLOperation.builder().extendTo(123L).build(); + Assert.assertNotEquals(operation1, operation2); + } + + @Test + public void testLedgersToExpireIsInvalidThrowsLessThanZero() { + try { + ExtendFootprintTTLOperation.builder().extendTo(-1L).build(); + Assert.fail(); + } catch (IllegalArgumentException e) { + Assert.assertEquals("extendTo isn't a ledger quantity (uint32)", e.getMessage()); + } + } + + @Test + public void testLedgersToExpireIsInvalidThrowsGreatThanMaxUint32() { + try { + ExtendFootprintTTLOperation.builder().extendTo(4294967296L).build(); + Assert.fail(); + } catch (IllegalArgumentException e) { + Assert.assertEquals("extendTo isn't a ledger quantity (uint32)", e.getMessage()); + } + } + + @Test + public void testLedgersToExpireIsNullThrows() { + try { + ExtendFootprintTTLOperation.builder().build(); + Assert.fail(); + } catch (NullPointerException e) { + Assert.assertEquals("extendTo is marked non-null but is null", e.getMessage()); + } + } +} diff --git a/src/test/java/org/stellar/sdk/InvokeHostFunctionOperationTest.java b/src/test/java/org/stellar/sdk/InvokeHostFunctionOperationTest.java index ee6c1e460..e49d0a4d8 100644 --- a/src/test/java/org/stellar/sdk/InvokeHostFunctionOperationTest.java +++ b/src/test/java/org/stellar/sdk/InvokeHostFunctionOperationTest.java @@ -51,7 +51,7 @@ public class InvokeHostFunctionOperationTest { .build()) .executable( new ContractExecutable.Builder() - .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build()) .build(); @@ -180,7 +180,7 @@ public void testNotEqualsHostFunction() { .build()) .executable( new ContractExecutable.Builder() - .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build()) .build(); HostFunction hostFunction2 = @@ -410,7 +410,8 @@ public void createTokenContractOperationBuilderWithAddress() { 0x1e, 0x1f }; InvokeHostFunctionOperation operation = - InvokeHostFunctionOperation.createTokenContractOperationBuilder(address, salt).build(); + InvokeHostFunctionOperation.createStellarAssetContractOperationBuilder(address, salt) + .build(); CreateContractArgs createContractArgs = new CreateContractArgs.Builder() .contractIDPreimage( @@ -424,7 +425,7 @@ public void createTokenContractOperationBuilderWithAddress() { .build()) .executable( new ContractExecutable.Builder() - .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build()) .build(); HostFunction expectedFunction = @@ -447,7 +448,7 @@ public void createTokenContractOperationBuilderWithAsset() { new AssetTypeCreditAlphaNum4( "CAT", "GAHJJJKMOKYE4RVPZEWZTKH5FVI4PA3VL7GK2LFNUBSGBV6OJP7TQSLX"); InvokeHostFunctionOperation operation = - InvokeHostFunctionOperation.createTokenContractOperationBuilder(asset).build(); + InvokeHostFunctionOperation.createStellarAssetContractOperationBuilder(asset).build(); CreateContractArgs createContractArgs = new CreateContractArgs.Builder() .contractIDPreimage( @@ -457,7 +458,7 @@ public void createTokenContractOperationBuilderWithAsset() { .build()) .executable( new ContractExecutable.Builder() - .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build()) .build(); HostFunction expectedFunction = diff --git a/src/test/java/org/stellar/sdk/SorobanDataBuilderTest.java b/src/test/java/org/stellar/sdk/SorobanDataBuilderTest.java index f85f51c3e..aa5fc56ff 100644 --- a/src/test/java/org/stellar/sdk/SorobanDataBuilderTest.java +++ b/src/test/java/org/stellar/sdk/SorobanDataBuilderTest.java @@ -55,7 +55,7 @@ public class SorobanDataBuilderTest { .readBytes(new Uint32(new XdrUnsignedInteger(0))) .writeBytes(new Uint32(new XdrUnsignedInteger(0))) .build()) - .refundableFee(new Int64(0L)) + .resourceFee(new Int64(0L)) .ext(new ExtensionPoint.Builder().discriminant(0).build()) .build(); @@ -72,7 +72,7 @@ public class SorobanDataBuilderTest { .readBytes(new Uint32(new XdrUnsignedInteger(2))) .writeBytes(new Uint32(new XdrUnsignedInteger(3))) .build()) - .refundableFee(new Int64(5L)) + .resourceFee(new Int64(5L)) .ext(new ExtensionPoint.Builder().discriminant(0).build()) .build(); @@ -101,7 +101,7 @@ public void testSetProperties() { new SorobanDataBuilder() .setReadOnly(singletonList(readOnly)) .setReadWrite(singletonList(readWrite)) - .setRefundableFee(5) + .setResourceFee(5) .setResources( new SorobanDataBuilder.Resources.ResourcesBuilder() .cpuInstructions(1L) diff --git a/src/test/java/org/stellar/sdk/SorobanServerTest.java b/src/test/java/org/stellar/sdk/SorobanServerTest.java index bc504c511..79ac5d1f5 100644 --- a/src/test/java/org/stellar/sdk/SorobanServerTest.java +++ b/src/test/java/org/stellar/sdk/SorobanServerTest.java @@ -913,7 +913,7 @@ public void testPrepareTransactionWithSorobanData() .writeBytes(new Uint32(new XdrUnsignedInteger(0))) .instructions(new Uint32(new XdrUnsignedInteger(34567))) .build()) - .refundableFee(new Int64(100L)) + .resourceFee(new Int64(100L)) .ext(new ExtensionPoint.Builder().discriminant(0).build()) .build(); Transaction transaction = buildSorobanTransaction(originSorobanData, null); @@ -1020,7 +1020,7 @@ public void testPrepareTransactionWithAuth() .build()) .executable( new ContractExecutable.Builder() - .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build()) .build(); SorobanAuthorizationEntry auth = diff --git a/src/test/java/org/stellar/sdk/TransactionBuilderTest.java b/src/test/java/org/stellar/sdk/TransactionBuilderTest.java index 4a58520bc..28cd47ef4 100644 --- a/src/test/java/org/stellar/sdk/TransactionBuilderTest.java +++ b/src/test/java/org/stellar/sdk/TransactionBuilderTest.java @@ -971,7 +971,7 @@ public void voidBuilderSorobanDataXdrString() { .writeBytes(new Uint32(new XdrUnsignedInteger(0))) .instructions(new Uint32(new XdrUnsignedInteger(34567))) .build()) - .refundableFee(new Int64(100L)) + .resourceFee(new Int64(100L)) .ext(new ExtensionPoint.Builder().discriminant(0).build()) .build(); @@ -1026,7 +1026,7 @@ public void voidBuilderSorobanDataXdrObject() throws IOException { .writeBytes(new Uint32(new XdrUnsignedInteger(0))) .instructions(new Uint32(new XdrUnsignedInteger(34567))) .build()) - .refundableFee(new Int64(100L)) + .resourceFee(new Int64(100L)) .ext(new ExtensionPoint.Builder().discriminant(0).build()) .build(); String sorobanDataString = sorobanData.toXdrBase64(); @@ -1047,7 +1047,7 @@ public void voidBuilderSorobanDataXdrObject() throws IOException { .build()) .executable( new ContractExecutable.Builder() - .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build()) .build(); HostFunction hostFunction = diff --git a/src/test/java/org/stellar/sdk/TransactionTest.java b/src/test/java/org/stellar/sdk/TransactionTest.java index 164bc9cb4..52b63bf67 100644 --- a/src/test/java/org/stellar/sdk/TransactionTest.java +++ b/src/test/java/org/stellar/sdk/TransactionTest.java @@ -226,7 +226,7 @@ public void testConstructorWithSorobanData() throws IOException { .writeBytes(new Uint32(new XdrUnsignedInteger(0))) .instructions(new Uint32(new XdrUnsignedInteger(34567))) .build()) - .refundableFee(new Int64(100L)) + .resourceFee(new Int64(100L)) .ext(new ExtensionPoint.Builder().discriminant(0).build()) .build(); @@ -246,7 +246,7 @@ public void testConstructorWithSorobanData() throws IOException { .build()) .executable( new ContractExecutable.Builder() - .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_TOKEN) + .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build()) .build(); HostFunction hostFunction = @@ -310,7 +310,7 @@ public void testIsSorobanTransactionInvokeHostFunctionOperation() { } @Test - public void testIsSorobanTransactionBumpFootprintExpirationOperation() { + public void testIsSorobanTransactionExtendFootprintTTLOperation() { KeyPair source = KeyPair.fromSecretSeed("SCH27VUZZ6UAKB67BDNF6FA42YMBMQCBKXWGMFD5TZ6S5ZZCZFLRXKHS"); @@ -330,8 +330,8 @@ public void testIsSorobanTransactionBumpFootprintExpirationOperation() { .build()) .build())) .build(); - BumpFootprintExpirationOperation operation = - BumpFootprintExpirationOperation.builder().ledgersToExpire(4096L).build(); + ExtendFootprintTTLOperation operation = + ExtendFootprintTTLOperation.builder().extendTo(4096L).build(); Transaction transaction = new Transaction( AccountConverter.enableMuxed(), diff --git a/src/test/java/org/stellar/sdk/responses/OperationDeserializerTest.java b/src/test/java/org/stellar/sdk/responses/OperationDeserializerTest.java index cd7c46274..fd78ade0c 100644 --- a/src/test/java/org/stellar/sdk/responses/OperationDeserializerTest.java +++ b/src/test/java/org/stellar/sdk/responses/OperationDeserializerTest.java @@ -16,7 +16,6 @@ import org.stellar.sdk.Price; import org.stellar.sdk.responses.operations.AccountMergeOperationResponse; import org.stellar.sdk.responses.operations.AllowTrustOperationResponse; -import org.stellar.sdk.responses.operations.BumpFootprintExpirationOperationResponse; import org.stellar.sdk.responses.operations.BumpSequenceOperationResponse; import org.stellar.sdk.responses.operations.ChangeTrustOperationResponse; import org.stellar.sdk.responses.operations.ClaimClaimableBalanceOperationResponse; @@ -25,6 +24,7 @@ import org.stellar.sdk.responses.operations.CreateAccountOperationResponse; import org.stellar.sdk.responses.operations.CreateClaimableBalanceOperationResponse; import org.stellar.sdk.responses.operations.EndSponsoringFutureReservesOperationResponse; +import org.stellar.sdk.responses.operations.ExtendFootprintTTLOperationResponse; import org.stellar.sdk.responses.operations.InflationOperationResponse; import org.stellar.sdk.responses.operations.InvokeHostFunctionOperationResponse; import org.stellar.sdk.responses.operations.LiquidityPoolDepositOperationResponse; @@ -1959,7 +1959,7 @@ public void testDeserializeInvokeHostFunctionOperation() { } @Test - public void testDeserializeBumpFootprintExpirationOperation() { + public void testDeserializeExtendFootprintTTLOperation() { String json = "{\n" + " \"_links\": {\n" @@ -1987,11 +1987,11 @@ public void testDeserializeBumpFootprintExpirationOperation() { + " \"type_i\": 25,\n" + " \"created_at\": \"2023-07-20T10:44:56Z\",\n" + " \"transaction_hash\": \"c452cd9d1ff9692499d0d2aa2f8e898b8c38025300c0f293f4a2adde7295c82f\",\n" - + " \"ledgers_to_expire\": \"2343241\"\n" + + " \"extend_to\": \"2343241\"\n" + "}"; - BumpFootprintExpirationOperationResponse operation = - (BumpFootprintExpirationOperationResponse) + ExtendFootprintTTLOperationResponse operation = + (ExtendFootprintTTLOperationResponse) GsonSingleton.getInstance().fromJson(json, OperationResponse.class); assertEquals( operation.getLinks().getSelf().getHref(), "http://127.0.0.1:8000/operations/2224793063426"); @@ -2005,7 +2005,7 @@ public void testDeserializeBumpFootprintExpirationOperation() { assertEquals( operation.getTransactionHash(), "c452cd9d1ff9692499d0d2aa2f8e898b8c38025300c0f293f4a2adde7295c82f"); - assertEquals(operation.getLedgersToExpire().longValue(), 2343241); + assertEquals(operation.getExtendTo().longValue(), 2343241); } @Test From d19bfd63249c42731ffda3eb6af7e8ce6462f29c Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Thu, 26 Oct 2023 23:14:27 +0800 Subject: [PATCH 3/5] update rpc structure --- .../sorobanrpc/GetEventsResponse.java | 8 +---- .../sorobanrpc/GetLedgerEntriesResponse.java | 3 ++ .../org/stellar/sdk/SorobanServerTest.java | 34 +++++++++---------- .../sorobanrpc/GetEventsDeserializerTest.java | 23 +++++-------- .../GetLedgerEntriesDeserializerTest.java | 6 +++- .../SimulateTransactionDeserializerTest.java | 4 +-- 6 files changed, 36 insertions(+), 42 deletions(-) diff --git a/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetEventsResponse.java b/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetEventsResponse.java index 0dbd2cbf4..79ffeedb3 100644 --- a/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetEventsResponse.java +++ b/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetEventsResponse.java @@ -35,14 +35,8 @@ public static class EventInfo { List topic; - EventInfoValue value; + String value; Boolean inSuccessfulContractCall; } - - @AllArgsConstructor - @Value - public static class EventInfoValue { - String xdr; - } } diff --git a/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesResponse.java b/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesResponse.java index 4fc8dfbb3..ece5c1af2 100644 --- a/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesResponse.java +++ b/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesResponse.java @@ -27,5 +27,8 @@ public static class LedgerEntryResult { @SerializedName("lastModifiedLedgerSeq") Long lastModifiedLedger; + + @SerializedName("expirationLedgerSeq") + Long expirationLedger; } } diff --git a/src/test/java/org/stellar/sdk/SorobanServerTest.java b/src/test/java/org/stellar/sdk/SorobanServerTest.java index 79ac5d1f5..85c221368 100644 --- a/src/test/java/org/stellar/sdk/SorobanServerTest.java +++ b/src/test/java/org/stellar/sdk/SorobanServerTest.java @@ -82,7 +82,8 @@ public void testGetAccount() + " {\n" + " \"key\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JA==\",\n" + " \"xdr\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JAAAABdIcDhpAAADHAAAAAwAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAABfI8AAAAAZMK3qQ==\",\n" - + " \"lastModifiedLedgerSeq\": \"97423\"\n" + + " \"lastModifiedLedgerSeq\": \"97423\",\n" + + " \"expirationLedgerSeq\": \"97673\"\n" + " }\n" + " ],\n" + " \"latestLedger\": \"108023\"\n" @@ -216,7 +217,8 @@ public void testGetContractData() throws IOException, SorobanRpcErrorResponse { + " {\n" + " \"key\": \"AAAABgAAAAFgdoLyR3pr6M3w/fMr4T1fJaaGzAlP2T1ao9e2gjLQwAAAABQAAAABAAAAAA==\",\n" + " \"xdr\": \"AAAABgAAAAFgdoLyR3pr6M3w/fMr4T1fJaaGzAlP2T1ao9e2gjLQwAAAABQAAAABAAAAAAAAAAAAAAATAAAAALnBupvoT7RHZ+oTeaPHSiSufpac3O3mc0u663Kqbko/AAAAAQAAAAEAAAAPAAAAB0NPVU5URVIAAAAAAwAAAAEAABD1\",\n" - + " \"lastModifiedLedgerSeq\": \"290\"\n" + + " \"lastModifiedLedgerSeq\": \"290\",\n" + + " \"expirationLedgerSeq\": \"490\"\n" + " }\n" + " ],\n" + " \"latestLedger\": \"296\"\n" @@ -274,6 +276,7 @@ public MockResponse dispatch(@NotNull RecordedRequest recordedRequest) server.getContractData(contractId, key, SorobanServer.Durability.PERSISTENT); assertTrue(resp.isPresent()); assertEquals(resp.get().getLastModifiedLedger().longValue(), 290L); + assertEquals(resp.get().getExpirationLedger().longValue(), 490L); assertEquals( resp.get().getKey(), "AAAABgAAAAFgdoLyR3pr6M3w/fMr4T1fJaaGzAlP2T1ao9e2gjLQwAAAABQAAAABAAAAAA=="); @@ -360,12 +363,14 @@ public void testGetLedgerEntries() throws IOException, SorobanRpcErrorResponse { + " {\n" + " \"key\": \"AAAAAAAAAACynni6I2ACEzWuORVM1b2y0k1ZDni0W6JlC/Ad/mfCSg==\",\n" + " \"xdr\": \"AAAAAAAAAACynni6I2ACEzWuORVM1b2y0k1ZDni0W6JlC/Ad/mfCSgAAABdIdugAAAAAnwAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA\",\n" - + " \"lastModifiedLedgerSeq\": \"159\"\n" + + " \"lastModifiedLedgerSeq\": \"159\",\n" + + " \"expirationLedgerSeq\": \"499\"\n" + " },\n" + " {\n" + " \"key\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JA==\",\n" + " \"xdr\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JAAAABdIcmH6AAAAoQAAAAgAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAHAkAAAAAZMPQ0g==\",\n" - + " \"lastModifiedLedgerSeq\": \"7177\"\n" + + " \"lastModifiedLedgerSeq\": \"7177\",\n" + + " \"expirationLedgerSeq\": \"7288\"\n" + " }\n" + " ],\n" + " \"latestLedger\": \"7943\"\n" @@ -508,32 +513,28 @@ public void testGetEvents() throws IOException, SorobanRpcErrorResponse { + " \"type\": \"contract\",\n" + " \"ledger\": \"107\",\n" + " \"ledgerClosedAt\": \"2023-07-28T14:57:02Z\",\n" - + " \"contractId\": \"607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0\",\n" + + " \"contractId\": \"CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K\",\n" + " \"id\": \"0000000459561504768-0000000000\",\n" + " \"pagingToken\": \"0000000459561504768-0000000000\",\n" + " \"topic\": [\n" + " \"AAAADwAAAAdDT1VOVEVSAA==\",\n" + " \"AAAADwAAAAlpbmNyZW1lbnQAAAA=\"\n" + " ],\n" - + " \"value\": {\n" - + " \"xdr\": \"AAAAAwAAAAQ=\"\n" - + " },\n" + + " \"value\": \"AAAAAwAAAAQ=\",\n" + " \"inSuccessfulContractCall\": true\n" + " },\n" + " {\n" + " \"type\": \"contract\",\n" + " \"ledger\": \"109\",\n" + " \"ledgerClosedAt\": \"2023-07-28T14:57:04Z\",\n" - + " \"contractId\": \"607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0\",\n" + + " \"contractId\": \"CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K\",\n" + " \"id\": \"0000000468151439360-0000000000\",\n" + " \"pagingToken\": \"0000000468151439360-0000000000\",\n" + " \"topic\": [\n" + " \"AAAADwAAAAdDT1VOVEVSAA==\",\n" + " \"AAAADwAAAAlpbmNyZW1lbnQAAAA=\"\n" + " ],\n" - + " \"value\": {\n" - + " \"xdr\": \"AAAAAwAAAAU=\"\n" - + " },\n" + + " \"value\": \"AAAAAwAAAAU=\",\n" + " \"inSuccessfulContractCall\": true\n" + " }\n" + " ],\n" @@ -543,8 +544,7 @@ public void testGetEvents() throws IOException, SorobanRpcErrorResponse { GetEventsRequest.EventFilter eventFilter = GetEventsRequest.EventFilter.builder() - .contractIds( - singletonList("607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0")) + .contractIds(singletonList("CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K")) .type(EventFilterType.CONTRACT) .topic(Arrays.asList("AAAADwAAAAdDT1VOVEVSAA==", "AAAADwAAAAlpbmNyZW1lbnQAAAA=")) .build(); @@ -592,13 +592,13 @@ public MockResponse dispatch(@NotNull RecordedRequest recordedRequest) assertEquals(resp.getEvents().get(0).getLedgerClosedAt(), "2023-07-28T14:57:02Z"); assertEquals( resp.getEvents().get(0).getContractId(), - "607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0"); + "CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K"); assertEquals(resp.getEvents().get(0).getId(), "0000000459561504768-0000000000"); assertEquals(resp.getEvents().get(0).getPagingToken(), "0000000459561504768-0000000000"); assertEquals(resp.getEvents().get(0).getTopic().size(), 2); assertEquals(resp.getEvents().get(0).getTopic().get(0), "AAAADwAAAAdDT1VOVEVSAA=="); assertEquals(resp.getEvents().get(0).getTopic().get(1), "AAAADwAAAAlpbmNyZW1lbnQAAAA="); - assertEquals(resp.getEvents().get(0).getValue().getXdr(), "AAAAAwAAAAQ="); + assertEquals(resp.getEvents().get(0).getValue(), "AAAAAwAAAAQ="); assertEquals(resp.getEvents().get(0).getInSuccessfulContractCall(), true); server.close(); @@ -1108,7 +1108,7 @@ public void testPrepareTransactionWithPrepareTransactionExceptionThrowsErrorResp + " \"jsonrpc\": \"2.0\",\n" + " \"id\": \"7b6ada2bdec04ee28147d1557aadc3cf\",\n" + " \"result\": {\n" - + " \"error\": \"HostError: Error(WasmVm, MissingValue)\\n\\nEvent log (newest first):\\n 0: [Diagnostic Event] contract:607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0, topics:[error, Error(WasmVm, MissingValue)], data:[\\\"invoking unknown export\\\", increment]\\n 1: [Diagnostic Event] topics:[fn_call, Bytes(607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0), increment], data:[Address(Account(58b7c4a2c8f297aa8f3d2471281fdfccecafe48e5663313ec18e12a73eca98a1)), 10]\\n\\nBacktrace (newest first):\\n 0: soroban_env_host::vm::Vm::invoke_function_raw\\n 1: soroban_env_host::host::frame::::call_n_internal\\n 2: soroban_env_host::host::frame::::invoke_function\\n 3: preflight::preflight_invoke_hf_op::{{closure}}\\n 4: preflight::catch_preflight_panic\\n 5: _cgo_a3255893d7fd_Cfunc_preflight_invoke_hf_op\\n at /tmp/go-build/cgo-gcc-prolog:99:11\\n 6: runtime.asmcgocall\\n at ./runtime/asm_amd64.s:848\\n\\n\",\n" + + " \"error\": \"HostError: Error(WasmVm, MissingValue)\\n\\nEvent log (newest first):\\n 0: [Diagnostic Event] contract:CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K, topics:[error, Error(WasmVm, MissingValue)], data:[\\\"invoking unknown export\\\", increment]\\n 1: [Diagnostic Event] topics:[fn_call, Bytes(CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K), increment], data:[Address(Account(58b7c4a2c8f297aa8f3d2471281fdfccecafe48e5663313ec18e12a73eca98a1)), 10]\\n\\nBacktrace (newest first):\\n 0: soroban_env_host::vm::Vm::invoke_function_raw\\n 1: soroban_env_host::host::frame::::call_n_internal\\n 2: soroban_env_host::host::frame::::invoke_function\\n 3: preflight::preflight_invoke_hf_op::{{closure}}\\n 4: preflight::catch_preflight_panic\\n 5: _cgo_a3255893d7fd_Cfunc_preflight_invoke_hf_op\\n at /tmp/go-build/cgo-gcc-prolog:99:11\\n 6: runtime.asmcgocall\\n at ./runtime/asm_amd64.s:848\\n\\n\",\n" + " \"transactionData\": null,\n" + " \"events\": null,\n" + " \"minResourceFee\": \"0\",\n" diff --git a/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetEventsDeserializerTest.java b/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetEventsDeserializerTest.java index 0f162dd80..5bbcbf58a 100644 --- a/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetEventsDeserializerTest.java +++ b/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetEventsDeserializerTest.java @@ -20,14 +20,13 @@ public void testDeserialize() { assertEquals(eventInfo0.getLedger().intValue(), 108); assertEquals(eventInfo0.getLedgerClosedAt(), "2023-07-23T14:47:01Z"); assertEquals( - eventInfo0.getContractId(), - "607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0"); + eventInfo0.getContractId(), "CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K"); assertEquals(eventInfo0.getId(), "0000000463856472064-0000000000"); assertEquals(eventInfo0.getPagingToken(), "0000000463856472064-0000000000"); assertEquals(eventInfo0.getTopic().size(), 2); assertEquals(eventInfo0.getTopic().get(0), "AAAADwAAAAdDT1VOVEVSAA=="); assertEquals(eventInfo0.getTopic().get(1), "AAAADwAAAAlpbmNyZW1lbnQAAAA="); - assertEquals(eventInfo0.getValue().getXdr(), "AAAAAwAAAAE="); + assertEquals(eventInfo0.getValue(), "AAAAAwAAAAE="); assertEquals(eventInfo0.getInSuccessfulContractCall(), true); GetEventsResponse.EventInfo eventInfo1 = getEventsResponse.getResult().getEvents().get(1); @@ -47,48 +46,42 @@ public void testDeserialize() { + " \"type\": \"contract\",\n" + " \"ledger\": \"108\",\n" + " \"ledgerClosedAt\": \"2023-07-23T14:47:01Z\",\n" - + " \"contractId\": \"607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0\",\n" + + " \"contractId\": \"CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K\",\n" + " \"id\": \"0000000463856472064-0000000000\",\n" + " \"pagingToken\": \"0000000463856472064-0000000000\",\n" + " \"topic\": [\n" + " \"AAAADwAAAAdDT1VOVEVSAA==\",\n" + " \"AAAADwAAAAlpbmNyZW1lbnQAAAA=\"\n" + " ],\n" - + " \"value\": {\n" - + " \"xdr\": \"AAAAAwAAAAE=\"\n" - + " },\n" + + " \"value\": \"AAAAAwAAAAE=\",\n" + " \"inSuccessfulContractCall\": true\n" + " },\n" + " {\n" + " \"type\": \"system\",\n" + " \"ledger\": \"111\",\n" + " \"ledgerClosedAt\": \"2023-07-23T14:47:04Z\",\n" - + " \"contractId\": \"607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0\",\n" + + " \"contractId\": \"CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K\",\n" + " \"id\": \"0000000476741373952-0000000000\",\n" + " \"pagingToken\": \"0000000476741373952-0000000000\",\n" + " \"topic\": [\n" + " \"AAAADwAAAAdDT1VOVEVSAA==\",\n" + " \"AAAADwAAAAlpbmNyZW1lbnQAAAA=\"\n" + " ],\n" - + " \"value\": {\n" - + " \"xdr\": \"AAAAAwAAAAI=\"\n" - + " },\n" + + " \"value\": \"AAAAAwAAAAI=\",\n" + " \"inSuccessfulContractCall\": true\n" + " },\n" + " {\n" + " \"type\": \"diagnostic\",\n" + " \"ledger\": \"114\",\n" + " \"ledgerClosedAt\": \"2023-07-23T14:47:07Z\",\n" - + " \"contractId\": \"607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0\",\n" + + " \"contractId\": \"CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K\",\n" + " \"id\": \"0000000489626275840-0000000000\",\n" + " \"pagingToken\": \"0000000489626275840-0000000000\",\n" + " \"topic\": [\n" + " \"AAAADwAAAAdDT1VOVEVSAA==\",\n" + " \"AAAADwAAAAlpbmNyZW1lbnQAAAA=\"\n" + " ],\n" - + " \"value\": {\n" - + " \"xdr\": \"AAAAAwAAAAM=\"\n" - + " },\n" + + " \"value\": \"AAAAAwAAAAM=\",\n" + " \"inSuccessfulContractCall\": true\n" + " }\n" + " ],\n" diff --git a/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesDeserializerTest.java b/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesDeserializerTest.java index 279e15e2f..91919f23a 100644 --- a/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesDeserializerTest.java +++ b/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesDeserializerTest.java @@ -32,6 +32,9 @@ public void testDeserializeEntriesNotNull() { .getLastModifiedLedger() .longValue(), 695); + assertEquals( + getLedgerEntriesResponse.getResult().getEntries().get(0).getExpirationLedger().longValue(), + 996); } @Test @@ -54,7 +57,8 @@ public void testDeserializeEntriesNull() { + " {\n" + " \"key\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JA==\",\n" + " \"xdr\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JAAAABdIcjmeAAAAfgAAAAgAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAArcAAAAAZMIW+A==\",\n" - + " \"lastModifiedLedgerSeq\": \"695\"\n" + + " \"lastModifiedLedgerSeq\": \"695\",\n" + + " \"expirationLedgerSeq\": \"996\"\n" + " }\n" + " ],\n" + " \"latestLedger\": \"1457\"\n" diff --git a/src/test/java/org/stellar/sdk/responses/sorobanrpc/SimulateTransactionDeserializerTest.java b/src/test/java/org/stellar/sdk/responses/sorobanrpc/SimulateTransactionDeserializerTest.java index 2da5249e1..9164dd101 100644 --- a/src/test/java/org/stellar/sdk/responses/sorobanrpc/SimulateTransactionDeserializerTest.java +++ b/src/test/java/org/stellar/sdk/responses/sorobanrpc/SimulateTransactionDeserializerTest.java @@ -49,7 +49,7 @@ public void testDeserializeFailed() { SimulateTransactionResponse data = simulateTransactionResponse.getResult(); assertEquals( data.getError(), - "HostError: Error(WasmVm, MissingValue)\n\nEvent log (newest first):\n 0: [Diagnostic Event] contract:607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0, topics:[error, Error(WasmVm, MissingValue)], data:[\"invoking unknown export\", increment]\n 1: [Diagnostic Event] topics:[fn_call, Bytes(607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0), increment], data:[Address(Account(58b7c4a2c8f297aa8f3d2471281fdfccecafe48e5663313ec18e12a73eca98a1)), 10]\n\nBacktrace (newest first):\n 0: soroban_env_host::vm::Vm::invoke_function_raw\n 1: soroban_env_host::host::frame::::call_n_internal\n 2: soroban_env_host::host::frame::::invoke_function\n 3: preflight::preflight_invoke_hf_op::{{closure}}\n 4: preflight::catch_preflight_panic\n 5: _cgo_a3255893d7fd_Cfunc_preflight_invoke_hf_op\n at /tmp/go-build/cgo-gcc-prolog:99:11\n 6: runtime.asmcgocall\n at ./runtime/asm_amd64.s:848\n\n"); + "HostError: Error(WasmVm, MissingValue)\n\nEvent log (newest first):\n 0: [Diagnostic Event] contract:CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K, topics:[error, Error(WasmVm, MissingValue)], data:[\"invoking unknown export\", increment]\n 1: [Diagnostic Event] topics:[fn_call, Bytes(CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K), increment], data:[Address(Account(58b7c4a2c8f297aa8f3d2471281fdfccecafe48e5663313ec18e12a73eca98a1)), 10]\n\nBacktrace (newest first):\n 0: soroban_env_host::vm::Vm::invoke_function_raw\n 1: soroban_env_host::host::frame::::call_n_internal\n 2: soroban_env_host::host::frame::::invoke_function\n 3: preflight::preflight_invoke_hf_op::{{closure}}\n 4: preflight::catch_preflight_panic\n 5: _cgo_a3255893d7fd_Cfunc_preflight_invoke_hf_op\n at /tmp/go-build/cgo-gcc-prolog:99:11\n 6: runtime.asmcgocall\n at ./runtime/asm_amd64.s:848\n\n"); assertEquals(data.getTransactionData(), ""); assertNull(data.getEvents()); assertEquals(data.getMinResourceFee().longValue(), 0L); @@ -90,7 +90,7 @@ public void testDeserializeFailed() { + " \"jsonrpc\": \"2.0\",\n" + " \"id\": \"7b6ada2bdec04ee28147d1557aadc3cf\",\n" + " \"result\": {\n" - + " \"error\": \"HostError: Error(WasmVm, MissingValue)\\n\\nEvent log (newest first):\\n 0: [Diagnostic Event] contract:607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0, topics:[error, Error(WasmVm, MissingValue)], data:[\\\"invoking unknown export\\\", increment]\\n 1: [Diagnostic Event] topics:[fn_call, Bytes(607682f2477a6be8cdf0fdf32be13d5f25a686cc094fd93d5aa3d7b68232d0c0), increment], data:[Address(Account(58b7c4a2c8f297aa8f3d2471281fdfccecafe48e5663313ec18e12a73eca98a1)), 10]\\n\\nBacktrace (newest first):\\n 0: soroban_env_host::vm::Vm::invoke_function_raw\\n 1: soroban_env_host::host::frame::::call_n_internal\\n 2: soroban_env_host::host::frame::::invoke_function\\n 3: preflight::preflight_invoke_hf_op::{{closure}}\\n 4: preflight::catch_preflight_panic\\n 5: _cgo_a3255893d7fd_Cfunc_preflight_invoke_hf_op\\n at /tmp/go-build/cgo-gcc-prolog:99:11\\n 6: runtime.asmcgocall\\n at ./runtime/asm_amd64.s:848\\n\\n\",\n" + + " \"error\": \"HostError: Error(WasmVm, MissingValue)\\n\\nEvent log (newest first):\\n 0: [Diagnostic Event] contract:CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K, topics:[error, Error(WasmVm, MissingValue)], data:[\\\"invoking unknown export\\\", increment]\\n 1: [Diagnostic Event] topics:[fn_call, Bytes(CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K), increment], data:[Address(Account(58b7c4a2c8f297aa8f3d2471281fdfccecafe48e5663313ec18e12a73eca98a1)), 10]\\n\\nBacktrace (newest first):\\n 0: soroban_env_host::vm::Vm::invoke_function_raw\\n 1: soroban_env_host::host::frame::::call_n_internal\\n 2: soroban_env_host::host::frame::::invoke_function\\n 3: preflight::preflight_invoke_hf_op::{{closure}}\\n 4: preflight::catch_preflight_panic\\n 5: _cgo_a3255893d7fd_Cfunc_preflight_invoke_hf_op\\n at /tmp/go-build/cgo-gcc-prolog:99:11\\n 6: runtime.asmcgocall\\n at ./runtime/asm_amd64.s:848\\n\\n\",\n" + " \"transactionData\": \"\",\n" + " \"events\": null,\n" + " \"minResourceFee\": \"0\",\n" From 80cfaa4fc6f9b67fb67b44c2b44234d6a41abe89 Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Fri, 27 Oct 2023 10:40:43 +0800 Subject: [PATCH 4/5] update rpc structure, expirationLedgerSeq -> liveUntilLedgerSeq --- .../responses/sorobanrpc/GetLedgerEntriesResponse.java | 4 ++-- src/test/java/org/stellar/sdk/SorobanServerTest.java | 10 +++++----- .../sorobanrpc/GetLedgerEntriesDeserializerTest.java | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesResponse.java b/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesResponse.java index ece5c1af2..8be5c0004 100644 --- a/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesResponse.java +++ b/src/main/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesResponse.java @@ -28,7 +28,7 @@ public static class LedgerEntryResult { @SerializedName("lastModifiedLedgerSeq") Long lastModifiedLedger; - @SerializedName("expirationLedgerSeq") - Long expirationLedger; + @SerializedName("liveUntilLedgerSeq") + Long liveUntilLedger; } } diff --git a/src/test/java/org/stellar/sdk/SorobanServerTest.java b/src/test/java/org/stellar/sdk/SorobanServerTest.java index 85c221368..25511e425 100644 --- a/src/test/java/org/stellar/sdk/SorobanServerTest.java +++ b/src/test/java/org/stellar/sdk/SorobanServerTest.java @@ -83,7 +83,7 @@ public void testGetAccount() + " \"key\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JA==\",\n" + " \"xdr\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JAAAABdIcDhpAAADHAAAAAwAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAABfI8AAAAAZMK3qQ==\",\n" + " \"lastModifiedLedgerSeq\": \"97423\",\n" - + " \"expirationLedgerSeq\": \"97673\"\n" + + " \"liveUntilLedgerSeq\": \"97673\"\n" + " }\n" + " ],\n" + " \"latestLedger\": \"108023\"\n" @@ -218,7 +218,7 @@ public void testGetContractData() throws IOException, SorobanRpcErrorResponse { + " \"key\": \"AAAABgAAAAFgdoLyR3pr6M3w/fMr4T1fJaaGzAlP2T1ao9e2gjLQwAAAABQAAAABAAAAAA==\",\n" + " \"xdr\": \"AAAABgAAAAFgdoLyR3pr6M3w/fMr4T1fJaaGzAlP2T1ao9e2gjLQwAAAABQAAAABAAAAAAAAAAAAAAATAAAAALnBupvoT7RHZ+oTeaPHSiSufpac3O3mc0u663Kqbko/AAAAAQAAAAEAAAAPAAAAB0NPVU5URVIAAAAAAwAAAAEAABD1\",\n" + " \"lastModifiedLedgerSeq\": \"290\",\n" - + " \"expirationLedgerSeq\": \"490\"\n" + + " \"liveUntilLedgerSeq\": \"490\"\n" + " }\n" + " ],\n" + " \"latestLedger\": \"296\"\n" @@ -276,7 +276,7 @@ public MockResponse dispatch(@NotNull RecordedRequest recordedRequest) server.getContractData(contractId, key, SorobanServer.Durability.PERSISTENT); assertTrue(resp.isPresent()); assertEquals(resp.get().getLastModifiedLedger().longValue(), 290L); - assertEquals(resp.get().getExpirationLedger().longValue(), 490L); + assertEquals(resp.get().getLiveUntilLedger().longValue(), 490L); assertEquals( resp.get().getKey(), "AAAABgAAAAFgdoLyR3pr6M3w/fMr4T1fJaaGzAlP2T1ao9e2gjLQwAAAABQAAAABAAAAAA=="); @@ -364,13 +364,13 @@ public void testGetLedgerEntries() throws IOException, SorobanRpcErrorResponse { + " \"key\": \"AAAAAAAAAACynni6I2ACEzWuORVM1b2y0k1ZDni0W6JlC/Ad/mfCSg==\",\n" + " \"xdr\": \"AAAAAAAAAACynni6I2ACEzWuORVM1b2y0k1ZDni0W6JlC/Ad/mfCSgAAABdIdugAAAAAnwAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA\",\n" + " \"lastModifiedLedgerSeq\": \"159\",\n" - + " \"expirationLedgerSeq\": \"499\"\n" + + " \"liveUntilLedgerSeq\": \"499\"\n" + " },\n" + " {\n" + " \"key\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JA==\",\n" + " \"xdr\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JAAAABdIcmH6AAAAoQAAAAgAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAHAkAAAAAZMPQ0g==\",\n" + " \"lastModifiedLedgerSeq\": \"7177\",\n" - + " \"expirationLedgerSeq\": \"7288\"\n" + + " \"liveUntilLedgerSeq\": \"7288\"\n" + " }\n" + " ],\n" + " \"latestLedger\": \"7943\"\n" diff --git a/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesDeserializerTest.java b/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesDeserializerTest.java index 91919f23a..bb06805c0 100644 --- a/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesDeserializerTest.java +++ b/src/test/java/org/stellar/sdk/responses/sorobanrpc/GetLedgerEntriesDeserializerTest.java @@ -33,7 +33,7 @@ public void testDeserializeEntriesNotNull() { .longValue(), 695); assertEquals( - getLedgerEntriesResponse.getResult().getEntries().get(0).getExpirationLedger().longValue(), + getLedgerEntriesResponse.getResult().getEntries().get(0).getLiveUntilLedger().longValue(), 996); } @@ -58,7 +58,7 @@ public void testDeserializeEntriesNull() { + " \"key\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JA==\",\n" + " \"xdr\": \"AAAAAAAAAADBPp7TMinJylnn+6dQXJACNc15LF+aJ2Py1BaR4P10JAAAABdIcjmeAAAAfgAAAAgAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAArcAAAAAZMIW+A==\",\n" + " \"lastModifiedLedgerSeq\": \"695\",\n" - + " \"expirationLedgerSeq\": \"996\"\n" + + " \"liveUntilLedgerSeq\": \"996\"\n" + " }\n" + " ],\n" + " \"latestLedger\": \"1457\"\n" From 24a4876719f9a16d0cd5d25bfc7773ab7c4b5a97 Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Tue, 31 Oct 2023 14:25:03 +0800 Subject: [PATCH 5/5] docs --- CHANGELOG.md | 5 +++++ .../org/stellar/sdk/InvokeHostFunctionOperationTest.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cae7ca01..c7fd0a0a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ As this project is pre 1.0, breaking changes may happen for minor version bumps. ## Pending * Make `StrKey` public, this allows users to conveniently encode and decode Stellar keys to/from strings. ([#548](https://github.com/stellar/java-stellar-sdk/pull/548)) * Update `LedgerResponse` and `AccountResponse`, remove outdated fields, and add missing fields. ([#549](https://github.com/stellar/java-stellar-sdk/pull/549)) +* Update the SDK to the stable Protocol 20 release: [#553](https://github.com/stellar/java-stellar-sdk/pull/553) + - The `BumpFootprintExpirationOperation` is now `ExtendFootprintTTLOperation` and its `ledgersToExpire` field is now named `extendTo`, but it serves the same purpose. + - The `InvokeHostFunctionOperation.createTokenContractOperationBuilder` is now `InvokeHostFunctionOperation.createStellarAssetContractOperationBuilder`. + - `SorobanDataBuilder.setRefundableFee` is now `setResourceFee`. + - The RPC endpoint structure has changed, check [#552](https://github.com/stellar/java-stellar-sdk/issues/552) for more details. ## 0.41.1 * Add `org.stellar.sdk.spi.SdkProvider`, users can implement this interface to provide their own implementation of the SDK. We provide an [Android specific implementation](https://github.com/stellar/java-stellar-sdk-android-spi), if you are integrating this SDK into an Android project, be sure to check it out. ([#543](https://github.com/stellar/java-stellar-sdk/pull/543)) diff --git a/src/test/java/org/stellar/sdk/InvokeHostFunctionOperationTest.java b/src/test/java/org/stellar/sdk/InvokeHostFunctionOperationTest.java index e49d0a4d8..82a0cd522 100644 --- a/src/test/java/org/stellar/sdk/InvokeHostFunctionOperationTest.java +++ b/src/test/java/org/stellar/sdk/InvokeHostFunctionOperationTest.java @@ -401,7 +401,7 @@ public void createContractOperationBuilderWithWasmIdBytes() { } @Test - public void createTokenContractOperationBuilderWithAddress() { + public void createStellarAssetContractOperationBuilderWithAddress() { Address address = new Address("GAHJJJKMOKYE4RVPZEWZTKH5FVI4PA3VL7GK2LFNUBSGBV6OJP7TQSLX"); byte[] salt = new byte[] { @@ -443,7 +443,7 @@ public void createTokenContractOperationBuilderWithAddress() { } @Test - public void createTokenContractOperationBuilderWithAsset() { + public void createStellarAssetContractOperationBuilderWithAsset() { Asset asset = new AssetTypeCreditAlphaNum4( "CAT", "GAHJJJKMOKYE4RVPZEWZTKH5FVI4PA3VL7GK2LFNUBSGBV6OJP7TQSLX");