File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1
1
package models
2
2
3
+ import (
4
+ "fmt"
5
+ "strings"
6
+ )
7
+
3
8
// Set of common fields for every transaction
4
9
type BaseTransaction struct {
5
10
Account string
@@ -394,3 +399,25 @@ type Transaction struct {
394
399
TransactionTicketCreate
395
400
TransactionTrustSet
396
401
}
402
+
403
+ /*
404
+ * CTID spec: https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0037d-concise-transaction-identifier-ctid
405
+ */
406
+ type CTID struct {
407
+ LeadIn uint64
408
+ LedgerIndex uint64
409
+ TransactionIndex uint64
410
+ NetworkId uint64
411
+ }
412
+
413
+ /*
414
+ * Encode CTID struct to XLS-37 CTID
415
+ */
416
+ func (c * CTID ) Encode () string {
417
+ if c .LeadIn == 0 {
418
+ c .LeadIn = uint64 (0xC0000000 )
419
+ }
420
+ cti := (c .LeadIn + c .LedgerIndex )<< 32 + c .TransactionIndex << 16 + c .NetworkId
421
+ ctid := fmt .Sprintf ("%x" , cti )
422
+ return strings .ToUpper (ctid )
423
+ }
You can’t perform that action at this time.
0 commit comments