github.com/hashgraph/hedera-sdk-go/v2@v2.48.0/MIGRATING_V1.md (about)

     1  # Go V1 to V2
     2  
     3  - `TopicUpdateTransaction` missing `[get|set]ExpirationTime()`
     4  - `AccountUpdateTransaction` missing `SetInitialBalance` and `GetInitialBalance`
     5  
     6  v2.0.0
     7  
     8  - Renamed `Ed25519PublicKey` → `PublicKey`
     9      - Added `Verify([]byte, []byte) bool`
    10          - Verifies a message was signe by the respective private key.
    11      - Added `VerifyTransaction(Transaction) bool`
    12          - Verifies the transaction was signed by the respective private key.
    13  - Renamed `Ed25519PrivateKey` → `PrivateKey`
    14      - Added `SignTransaction(Transaction) []byte`
    15          - Signs the `Transaction` and returns the signature.
    16  - Removed `ThresholdKey`
    17      - Use `KeyListWithThreshold(uint) *KeyList`
    18  - Added `Key`
    19      - Added by `PublicKey`
    20      - Added by `PrivateKey`
    21      - Added by `KeyList`
    22      - Added by `ContractID`
    23  - `KeyList`
    24      - Added `AddAllPublicKeys([]PublicKey) *KeyList`
    25  - `Mnemonic`
    26      - Added `ToLegacyPrivateKey() (PrivateKey, error)`
    27      - Added `GenerateMnemonic24() (Mnemonic, error)`
    28      - Added `GenerateMnemonic12() (Mnemonic, error)`
    29      - Removed `GenerateMnemonic() (Mnemonic, error)`
    30          - Use `GenerateMnemonic12()` or `GenerateMnemonic24()` instead.
    31  - Removed `MirrorClient`
    32      - Use `Client` instead, and set the mirror network using `SetMirrorNetwork()`
    33  - Renamed `MirrorSubscriptionHandle` → `SubscriptionHandle`
    34  - Renamed `QueryBuilder` → `Query`
    35      - Removed `SetPaymentTransaction()`
    36      - Added `GetNodeAccountIDs() []AccountID`
    37      - Added `SetNodeAccountIDs([]AccountID) *Query`
    38      - Added `GetMaxRetryCount() int`
    39      - Added `SetMaxRetry(int) *Query`
    40  - Combined `TransactionBuilder` and `Transaction`
    41      - Renamed `Build(null)` → `Freeze() (Transaction, error)`
    42      - Renamed `Build(Client)` → `FreezeWith(Client) (Transaction, error)`
    43      - Added `TransactionFromBytes([]byte) (interface{}, error)`
    44      - Added `ToBytes() []byte`
    45      - Renamed `ID()` →`GetTransactionID()`
    46      - Added `GetMaxTransactionFee() Hbar`
    47      - Added `GetTransactionMemo() String`
    48      - Added `GetTransactionHashPerNode() (map[AccountID][]byte, error)`
    49      - Added `GetTransactionValidDuration() time.Duration`
    50      - Added `AddSignature(PublicKey, byte[]) Transaction`
    51      - Added `GetSignatures() (map[AccountID]map[*PublicKey][]byte, error)`
    52      - Added `GetNodeAccountIDs() []AccountID`
    53      - Removed `UnmarshalBinary([]byte) error`
    54      - Removed `MarshalBinary() ([]byte, error)`
    55      - Renamed `SetNodeAccountID(AccountID)` → `SetNodeAccountIDs([]AccountID)`
    56      - Added `GetTransactionHash() ([]byte, error)`
    57      - Added `SetMaxRetry(int) *Transaction`
    58      - Added `GetMaxRetry() int`
    59      - Added `IsFrozen() bool`
    60      - Changed `Execute(Client) (TransactionID, error)` → `Execute(Client) (TransactionResponse, error)`
    61      - Changed `Sign(Ed25519PrivateKey)` → `Sign(PrivateKey)`
    62      - Changed `SignWith(Ed25519PublicKey)` → `SignWith(PublicKey, TransactionSigner)`
    63  - `AccountBalanceQuery` extends (Query)
    64      - Changed `Execute(client *Client) (Hbar, error)` → `Execute(*Client) (AccountBalance, error)`
    65      - Added `GetAccountID() AccountID`
    66      - Added `GetContractID() ContactID`
    67  - Added `AccountBalance`
    68      - Added `Hbars Hbar`
    69      - Added `Token map[TokenID]uint64`
    70  - `AccountCreateTransaction` extends (Transaction)
    71      - Added `GetKey() (Key, error)`
    72      - Added `GetInitialBalance() Hbar`
    73      - Added `GetReceiverSignatureRequired() boolean`
    74      - Added `GetProxyAccountID() AccountID`
    75      - Added `GetAutoRenewPeriod() time.Duration`
    76      - Removed `SetSendRecordThreshold(Hbar)`
    77      - Removed `SetReceiveRecordThreshold(Hbar)`
    78  - `AccountDeleteTransaction` extends (Transaction)
    79      - Renamed `SetDeleteAccountID()` → `SetAccountID()`
    80      - Added `GetAccountID() AccountID`
    81      - Added `GetTransferAccountID() AccountID`
    82  - `AccountID`
    83      - Added `ToBytes() []byte`
    84      - Added `FromBytes(byte[]) AccountID`
    85  - `AccountInfo`
    86      - Added `ToBytes() []byte`
    87      - Added `FromBytes(byte[]) AccountInfo`
    88      - Added `TokenRelationships: []*TokenRelationship`
    89  - `AccountInfoQuery` extends (Query)
    90      - Added `GetAccountID() AccountID`
    91      - Renamed `Cost(Client)` → `GetCost(Client)`
    92  - `AccountRecordsQuery` extends (Query)
    93      - Added `GetAccountID() AccountID`
    94  - `AccountStakersQuery` extends (Query)
    95      - Added `GetAccountID() AccountID`
    96  - `AccountUpdateTransaction` extends (Transaction)
    97      - Added `GetAccountID() AccountID`
    98      - Added `GetKey() (Key, error)`
    99      - Added `GetInitialBalance() Hbar`
   100      - Added `GetReceiverSignatureRequired() boolean`
   101      - Added `GetProxyAccountID() AccountID`
   102      - Added `GetAutoRenewPeriod() time.Duration`
   103      - Added `GetExpirationTime() time.Time`
   104      - Removed `SetSendRecordThreshold(Hbar)`
   105      - Removed  `SetReceiveRecordThreshold(Hbar)`
   106  - Removed `CryptoTransferTranscation`
   107      - Use `TransferTransaction` instead.
   108  - `TransferTransaction` extends [`Transaction`]
   109      - Added `AddTokenTransfer(TokenID, AccountID, int64) TransferTransaction`
   110      - Added `GetTokenTransfers() map[TokenID][]TokenTransfer`
   111      - Added `AddHbarTransfer(AccountID, Hbar) TransferTransaction`
   112      - Added `GetHbarTransfers() map[AccountID]Hbar`
   113  - Renamed `ContractBytecodeQuery` → `ContractByteCodeQuery` extends (Query)
   114      - Added `GetContractID() ContractID`
   115  - `ContractCallQuery` extends (Query)
   116      - Added `GetContractID() ContractID`
   117      - Added `GetGas() uint64`
   118      - Added `GetFunctionParameters() []byte`
   119      - Added `SetFunctionParameters([]byte) *ContractCallQuery`
   120  - `ContractCreateTransaction` extends (Transaction)
   121      - Added `GetBytecodeFileID() FileID`
   122      - Added `GetAdminKey() (Key, error)`
   123      - Added `GetGas() uint64`
   124      - Added `GetInitialBalance() Hbar`
   125      - Added `GetAutoRenewDuration() time.Duration`
   126      - Added `GetProxyAccountID() AccountID`
   127      - Added `GetContractMemo() String`
   128      - Added `GetConstructorParameters() []byte`
   129      - Added `SetConstructorParametersRaw([]byte) *ContractCreateTransaction`
   130      - Removed `SetInitialBalance()`
   131  - `ContractDeleteTransaction` extends (Transaction)
   132      - Added `GetContractID() ContractID`
   133      - Added `GetTransferAccountID() AccountID`
   134      - Added `GetTransferContractID() ContractID`
   135  - `ContractExecuteTransaction` extends (Transaction)
   136      - Added `GetContractID() ContractID`
   137      - Added `GetGas() uint64`
   138      - Added `GetPayableAmount() Hbar`
   139      - Added `GetFunctionParameters() []byte`
   140  - `ContractID`
   141      - Added `ToBytes() []byte`
   142      - Added `FromBytes(byte[]) ContractID`
   143  - `ContractInfo`
   144      - Added `ToBytes() []byte`
   145      - Added `FromBytes(byte[]) ContractInfo`
   146  - `ContractInfoQuery` extends (Query)
   147      - Added `GetContractID() ContractID`
   148  - Removed `ContractRecordsQuery`
   149  - `ContractUpdateTransaction` extends (Transaction)
   150      - Added `GetContractID() ContractID`
   151      - Added `GetBytecodeFileID() FileID`
   152      - Added `GetAdminKey() (Key, error)`
   153      - Added `GetAutoRenewDuration() time.Duration`
   154      - Added `GetProxyAccountID() AccountID`
   155      - Added `GetContractMemo() String`
   156      - Added `GetExpirationTime() time.Time`
   157  - `FileAppendTransaction`
   158      - Added `GetFileID() FileID`
   159      - Added `GetContents() []byte`
   160  - `FileContentsQuery`
   161      - Added `GetFileID() FileID`
   162  - `FileCreateTransaction`
   163      - Added `GetContents() []byte`
   164      - Added `GetKeys() KeyList`
   165      - Added `GetExpirationTime() time.Time`
   166      - Renamed `AddKey(PublicKey)` → `SetKeys(Key...)`
   167  - `FileDeleteTransaction`
   168      - Added `GetFileID() FileID`
   169  - `FileID`
   170      - Added `ToBytes() []byte`
   171      - Added `FromBytes(byte[]) FileID`
   172  - `FileInfo`
   173      - Added `ToBytes() []byte`
   174      - Added `FromBytes(byte[]) FileInfo`
   175      - Update `Keys []PublicKey` → `Keys KeyList`
   176  - `FileInfoQuery`
   177      - Added `GetFileID() FileID`
   178  - `FileUpdateTransaction`
   179      - Added `GetFileID() FileID`
   180      - Added `GetContents() []byte`
   181      - Added `GetKeys() KeyList`
   182      - Added `GetExpirationTime() time.Time`
   183      - Renamed `AddKey(PublicKey)` → `SetKeys(Key...)`
   184  - Removed `ConsensusTopicMessage`
   185  - Renamed `MirrorConsensusTopicResponse` → `TopicMessage`
   186      - Added `TopicMessageChunk[] Chunks`
   187          - This will be non null for a topic message which is constructed from multiple transactions.
   188      - Renamed `Message []byte` → `Contents []byte`
   189      - Removed `GetMessage() []byte`
   190      - Removed `ConsensusTopicID TopicID`
   191  - Renamed `MirrorConsensusTopicChunk` → `TopicMessageChunk`
   192  - Renamed `MirrorTopicMessageQuery` → `TopicMessageQuery`
   193      - Change `Subscribe(MirrorClient, func(MirrorConsensusTopicResponse), func(error)) (MirrorSubscriptionHandle, error)`→ `Subscribe(*Client, func(TopicMessage)) (SubscriptionHandle, error)`
   194  - Renamed `ConsensusTopicCreateTransaction` → `TopicCreateTransaction`
   195      - Added `GetTopicMemo() String`
   196      - Added `GetAdminKey() (Key, error)`
   197      - Added `GetSubmitKey() (Key, error)`
   198      - Added `GetAutoRenewDuration() time.Duration`
   199      - Added `GetAutoRenewAccountID() AccountID`
   200  - Renamed `ConsensusTopicDeleteTransaction` → `TopicDeleteTransaction`
   201      - Added `GetTopicID() TopicID`
   202  - Renamed `ConsensusMessageSubmitTransaction` → `TopicMessageSubmitTransaction`
   203      - Added `GetTopicID() TopicID`
   204      - Added `GetMessage() []byte`
   205      - Removed `SetChunkInfo(TransactionID, int, int)`
   206      - Added `GetMaxChunks() uint64`
   207  - Renamed `ConsensusTopicID` → `TopicID`
   208  - Renamed `ConsensusTopicInfo` → `TopicInfo`
   209      - Added `ToBytes() []byte`
   210      - Added `FromBytes() TopicInfo`
   211      - Change `AdminKey Ed25519PublicKey`  and  `SubmitKey Ed25519PublicKey`→ `AdminKey Key` and `SubmitKey Key`
   212  - Renamed `ConsensusTopicInfoQuery` → `TopicInfoQuery`
   213      - Added `GetTopicID() TopicID`
   214  - Renamed `ConsensusTopicUpdateTransaction` → `TopicUpdateTransaction`
   215      - Added `GetTopicID() TopicID`
   216      - Added `GetTopicMemo() String`
   217      - Added `GetAdminKey() (Key, error)`
   218      - Added `GetSubmitKey() (Key, error)`
   219      - Added `GetAutoRenewDuration() time.Duration`
   220      - Added `GetAutoRenewAccountID() AccountID`
   221  - `TokenAssociateTransaction` extends (Transaction)
   222      - Added `GetAccountID() AccountID`
   223      - Added  `SetTokenIDs([]TokenID)`
   224      - Added `GetTokenIDs() []TokenID`
   225  - Removed `TokenBalanceQuery`
   226      - Use `AccountBalanceQuery` to fetch token balances since `AccountBalance` contains `tokenBalances`.
   227  - `TokenBurnTransaction` extends (Transaction)
   228      - Added `GetTokenID() TokenID`
   229      - Added `GetAmount() uint64`
   230  - `TokenCreateTransaction` extends (Transaction)
   231      - Renamed `SetName(String)` →`setTokenName(String)`
   232      - Added `GetTokenName() string`
   233      - Renamed `SetSymbol(String)` →`setTokenSymbol(String)`
   234      - Added `GetTokenSymbol() string`
   235      - Renamed `SetTreasury(AccountID)` →`setTreasuryAccountID(AccountID)`
   236      - Renamed `SetAutoRenewAccount(AccountID)` →`setAutoRenewAccountID(AccountID)`
   237      - Added `GetAutoRenewAccountID() AccountID`
   238      - Added `GetTreasuryAccountID() AccountID`
   239      - Added `GetAdminKey() (Key, error)`
   240      - Added `GetKycKey() (Key, error)`
   241      - Added `GetSupplyKey() (Key, error)`
   242      - Added `GetWipeKey() (Key, error)`
   243      - Added `GetFreezeKey() (Key, error)`
   244      - Added `GetFreezeDefault() boolean`
   245      - Added `GetExpirationTime() time.Time`
   246      - Added `GetAutoRenewAccountID() AccountID`
   247      - Added `GetAutoRenewPeriod() time.Duration`
   248      - Added `GetDecimals() int`
   249  - `TokenDeleteTransaction` extends (Transaction)
   250      - Added `GetTokenID() TokenID`
   251  - `TokenDisassociateTransaction` extends (Transaction)
   252      - Added `GetAccountID() AccountID`
   253      - Added `GetTokenIDs() []TokenID`
   254      - Added `SetTokenIDs([]TokenID)`
   255  - `TokenFreezeTransaction` extends (Transaction)
   256      - Added `GetTokenID() TokenID`
   257      - Added `GetAccointId() AccountID`
   258  - `TokenGrantKycTransaction` extends (Transaction)
   259      - Added `GetTokenID() TokenID`
   260      - Added `GetAccointId() AccountID`
   261  - `TokenID`
   262      - Added `ToBytes() []byte`
   263      - Added `FromBytes(byte[]) TokenID`
   264  - `TokenInfo`
   265      - Added `ToBytes() []byte`
   266      - Added `FromBytes(byte[]) TokenInfo`
   267  - `TokenInfoQuery` extends (Query)
   268      - Added `GetTokenID() TokenID`
   269  - `TokenMintTransaction` extends (Transaction)
   270      - Added `GetTokenID() TokenID`
   271      - Added `GetAmount() uint64`
   272  - `TokenRelationship`
   273      - Added `ToBytes() []byte`
   274      - Added `FromBytes(byte[]) TokenRelationship`
   275  - `TokenRevokeKycTransaction` extends (Transaction)
   276      - Added `GetTokenID() TokenID`
   277      - Added `GetAccointId() AccountID`
   278  - Removed `TokenTransferTransaction`
   279      - Use `TransferTransaction` instead.
   280  - `TokenUnfreezeTransaction` extends (Transaction)
   281      - Added `GetTokenID() TokenID`
   282      - Added `GetAccountId() AccountID`
   283  - `TokenUpdateTransaction` extends (Transaction)
   284      - Renamed `SetName(String)` →`setTokenName(String)`
   285      - Added `GetTokenName() string`
   286      - Renamed `SetSymbol(String)` →`setTokenSymbol(String)`
   287      - Added `GetTokenSymbol() string`
   288      - Renamed `SetTreasury(AccountID)` →`setTreasuryAccountID(AccountID)`
   289      - Renamed `SetAutoRenewAccount(AccountID)` →`setAutoRenewAccountID(AccountID)`
   290      - Added `GetAutoRenewAccountID() AccountID`
   291      - Added `GetTreasuryAccountID() AccountID`
   292      - Added `GetAdminKey() (Key, error)`
   293      - Added `GetKycKey() (Key, error)`
   294      - Added `GetSupplyKey() (Key, error)`
   295      - Added `GetWipeKey() (Key, error)`
   296      - Added `GetFreezeKey() (Key, error)`
   297      - Added `GetFreezeDefault() boolean`
   298      - Added `GetExpirationTime() time.Time`
   299      - Added `GetAutoRenewAccountID() AccountID`
   300      - Added `GetAutoRenewPeriod() time.Duration`
   301      - Added `GetDecimals() int`
   302  - `TokenWipeTransaction` extends (Transaction)
   303      - Added `GetTokenID() TokenID`
   304      - Added `GetAccountID() AccountID`
   305  - `FreezeTransaction`
   306      - Added `GetStartTime() time.Time`
   307      - Added `GetEndTime() time.Time`
   308  - Removed `HbarRangeException`
   309      - If `Hbar` is out of range `Hedera` will error instead.
   310  - Removed `HederaConstants`
   311      - No replacement.
   312  - Removed `HederaNetworkException`
   313  - Renamed `HederaPrecheckStatusException` → `PrecheckStatusException`
   314  - Renamed `HederaReceiptStatusException` → `ReceiptStatusException`
   315  - Removed `HederaRecordStatusException`
   316      - `ReceiptStatusException` will be thrown instead.
   317  - Removed `HederaStatusException`
   318      - A `PrecheckStatusException` or `ReceiptStatusException` will be thrown instead.
   319  - Removed `HederaThrowable`
   320      - No replacement.
   321  - Removed `LocalValidationException`
   322      - No replacement. Local validation is no longer done.
   323  - `SystemDeleteTransaction`
   324      - Added `GetFileID() FileID`
   325      - Added `GetContractID() ContractID`
   326      - Added `GetExpirationTime() time.Time`
   327  - `SystemUndeleteTransaction`
   328      - Added `GetFileID() FileID`
   329      - Added `GetContractID() ContractID`
   330  - `TransactionID`
   331      - Added `ToBytes() []byte`
   332      - Added `FromBytes(byte[]) TransactionID`
   333      - Removed `TransactionID(TransactionIDOrBuilder)`
   334      - Removed `WithValidStart(AccountID, time.Time) TransactionID`
   335          - Use `TransactionID(AccountID, time.Time) new` instead.
   336      - Removed `TransactionID(AccountID)`
   337          - Use `Generate(AccountID) TransactionID` instead.
   338  - Removed `TransactionList`
   339  - `TransactionReciept`
   340      - Added `ToBytes() []byte`
   341      - Added `FromBytes() TransactionReceipt`
   342      - Expose `ExchangeRate *ExchangeRate`
   343      - Expose `AccountID *AccountID`
   344      - Expose `FileID *FileID`
   345      - Expose `ContractID *ContractID`
   346      - Expose `TopicID *TopicID`
   347      - Expose `TokenID *TokenID`
   348      - Expose `TopicSequenceNumber uint64`
   349      - Expose `topicRunningHash []byte`
   350      - Added `TotalSupply uint64`
   351      - Added `TopicRunningHashVersion uint64`
   352      - Removed `GetAccountID() AccountID`
   353          - Use `AccountID AccountID` directly instead.
   354      - Removed `GetContractID() ContractID`
   355          - Use `ContractID ContractID` directly instead.
   356      - Removed `GetFileID() FileID`
   357          - Use `FileID FileID` directly instead.
   358      - Removed `GetTokenID() TokenID`
   359          - Use `TokenID TokenID` directly instead.
   360      - Removed `GetConsensusTopicID() ConsensusTopicID`
   361          - Use `TopicID TopicID` directly instead.
   362      - Removed `GetConsensusTopicSequenceNumber()`
   363          - Use `sequenceNumber uint64` directly instead.
   364      - Removed `GetConsensusTopicRunningHash() []byte`
   365          - Use `topicRunningHash []byte` directly instead.
   366  - `TransactionReceiptQuery` extends (Query)
   367      - Added `GetTransactionID() TransactionID`
   368  - `TransactionRecord`
   369      - Added `ToBytes() []byte`
   370      - Added `FromBytes() TransactionRecord`
   371      - Added `CallResult *ContractFunctionResult`
   372      - Added `CallResultIsCreate bool`
   373      - Removed `GetContratcExecuteResult() ContractFunctionResult`
   374          - Use `ContractFunctionResult contractFunctionResult` directly instead.
   375      - Removed `GetContratcCreateResult() ContractFunctionResult`
   376          - Use `ContractFunctionResult contractFunctionResult` directly instead.
   377  - `TransactionRecordQuery` extends (Query)
   378      - Added `GetTransactionID() TransactionID`
   379  - `Hbar`
   380      - Added  `ToString(unit HbarUnit) string`
   381  - `Client`
   382      - Removed `NewClient(map[string]AccountID) *Client`
   383      - Added `SetMirrorNetwork([]String) void`
   384      - Added `GetMirrorNetwork() []String`
   385      - Added `ClientForNetwork(map[string]AccountID) *Client`
   386      - Added `Ping(AccountID) void`
   387      - Added `GetOperatorPublicKey() PublicKey`
   388      - Added `SetNetwork(map[string]AccountID) error`
   389      - Added `GetNetwork() map[string]AccountID`
   390      - Renamed `FromJson([]byte)` → `ClientFromConfig([]byte)`
   391      - Renamed `FromFile(String)` → `ClientFromConfigFile(String)`
   392      - Renamed `GetOperatorId()` → `getOperatorAccountID()`
   393      - Removed `ReplaceNodes(map[string]AccountID) *Client`
   394      - Removed `SetMaxTransactionFee() Client`
   395      - Removed `SetMaxQueryPayment() Client`