Skip to content

Commit efca372

Browse files
committed
fix: unaligned 64-bit atomic operation.
1 parent a4c885a commit efca372

23 files changed

+111
-110
lines changed

core/aptos/dapp.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ import (
1313
)
1414

1515
type SignMessagePayload struct {
16+
// A nonce the dApp should generate
17+
Nonce int64 `json:"nonce"`
18+
// The message to be signed and displayed to the user
19+
Message string `json:"message"`
1620
// Should we include the address of the account in the message
1721
Address bool `json:"address,omitempty"`
1822
// Should we include the domain of the dApp
1923
Application bool `json:"application,omitempty"`
2024
// Should we include the current chain id the wallet is connected to
2125
ChainId bool `json:"chainId,omitempty"`
22-
// The message to be signed and displayed to the user
23-
Message string `json:"message"`
24-
// A nonce the dApp should generate
25-
Nonce int64 `json:"nonce"`
2626
}
2727

2828
type SignMessageResponse struct {
29-
Address string `json:"address,omitempty"`
30-
Application string `json:"application,omitempty"`
3129
ChainId int64 `json:"chainId,omitempty"`
32-
Message string `json:"message"` // The message passed in by the user
3330
Nonce int64 `json:"nonce"`
31+
Address string `json:"address,omitempty"`
32+
Application string `json:"application,omitempty"`
33+
Message string `json:"message"` // The message passed in by the user
3434
Prefix string `json:"prefix"` // Should always be APTOS
3535
FullMessage string `json:"fullMessage"` // The message that was generated to sign
3636
Signature string `json:"signature"` // The signed full message

core/aptos/token.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ const (
1818
)
1919

2020
type Token struct {
21-
chain *Chain
22-
2321
token txbuilder.TypeTagStruct
22+
chain *Chain
2423
}
2524

2625
func NewMainToken(chain *Chain) *Token {
@@ -34,7 +33,7 @@ func NewToken(chain *Chain, tag string) (*Token, error) {
3433
if err != nil {
3534
return nil, err
3635
}
37-
return &Token{chain, *token}, nil
36+
return &Token{*token, chain}, nil
3837
}
3938

4039
// MARK - Implement the protocol Token
@@ -59,9 +58,9 @@ func (t *Token) TokenInfo() (*base.TokenInfo, error) {
5958
return nil, err
6059
}
6160
info := struct {
62-
Decimals int16 `json:"decimals"`
6361
Name string `json:"name"`
6462
Symbol string `json:"symbol"`
63+
Decimals int16 `json:"decimals"`
6564
}{}
6665
err = json.Unmarshal(jsonData, &info)
6766
if err != nil {

core/base/nft.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ import (
1010
)
1111

1212
type NFT struct {
13-
Timestamp int64 `json:"timestamp"`
13+
Timestamp int64 `json:"timestamp"`
14+
15+
// Aptos token's largest_property_version
16+
AptTokenVersion int64 `json:"apt_token_version"`
17+
// Aptos token's amount
18+
AptAmount int64 `json:"apt_amount"`
19+
1420
HashString string `json:"hashString"`
1521

1622
Id string `json:"id"`
@@ -22,11 +28,6 @@ type NFT struct {
2228
ContractAddress string `json:"contract_address"`
2329

2430
RelatedUrl string `json:"related_url"`
25-
26-
// Aptos token's largest_property_version
27-
AptTokenVersion int64 `json:"apt_token_version"`
28-
// Aptos token's amount
29-
AptAmount int64 `json:"apt_amount"`
3031
}
3132

3233
func (n *NFT) GroupName() string {

core/base/reach_monitor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
const reachFailedTime int64 = -1
1111

1212
type RpcLatency struct {
13-
RpcUrl string `json:"rpcUrl"`
1413
Latency int64 `json:"latency"`
1514
Height int64 `json:"height"`
15+
RpcUrl string `json:"rpcUrl"`
1616
}
1717

1818
// You can customize the test latency method of rpc
@@ -31,12 +31,12 @@ type ReachMonitorDelegate interface {
3131
}
3232

3333
type ReachMonitor struct {
34-
// The number of network connectivity tests to be performed per rpc. 0 means infinite, default is 1
35-
ReachCount int
3634
// Timeout for each connectivity test (ms). default 20000ms
3735
Timeout int64
3836
// Time interval between two network connectivity tests (ms). default 1500ms
3937
Delay int64
38+
// The number of network connectivity tests to be performed per rpc. 0 means infinite, default is 1
39+
ReachCount int
4040

4141
reachability RpcReachability
4242

core/base/transaction.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ const (
2727

2828
// Transaction details that can be fetched from the chain
2929
type TransactionDetail struct {
30+
// transaction completion timestamp (s), 0 if Status is in Pending
31+
FinishTimestamp int64
32+
Status TransactionStatus
33+
3034
// hash string on chain
3135
HashString string
3236

@@ -40,9 +44,6 @@ type TransactionDetail struct {
4044
// receiver's address
4145
ToAddress string
4246

43-
Status TransactionStatus
44-
// transaction completion timestamp (s), 0 if Status is in Pending
45-
FinishTimestamp int64
4647
// failure message
4748
FailureMessage string
4849

core/btc/brc20_mint.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ import (
1313
)
1414

1515
type Brc20MintTransaction struct {
16+
NetworkFee int64 `json:"network_fee"`
17+
SatpointFee int64 `json:"satpoint_fee"`
18+
ServiceFee int64 `json:"service_fee"`
19+
CommitFee int64 `json:"commit_fee"`
20+
CommitVsize int64 `json:"commit_vsize"`
21+
1622
CommitId string `json:"commit_id"`
1723
Commit string `json:"commit"`
1824
Reveal *base.StringArray `json:"reveal"`
1925
Inscription *base.StringArray `json:"inscription"`
2026

2127
CommitCustom *Brc20CommitCustom `json:"commit_custom"`
2228

23-
NetworkFee int64 `json:"network_fee"`
24-
SatpointFee int64 `json:"satpoint_fee"`
25-
ServiceFee int64 `json:"service_fee"`
26-
CommitFee int64 `json:"commit_fee"`
27-
CommitVsize int64 `json:"commit_vsize"`
28-
2929
signedTxn *SignedPsbtTransaction
3030
}
3131

@@ -159,18 +159,18 @@ func (c *Chain) BuildBrc20MintWithPostage(sender, receiver string, op, ticker, a
159159
}
160160

161161
var r struct {
162+
NetworkFee int64 `json:"network_fee"`
163+
SatpointFee int64 `json:"satpoint_fee"`
164+
ServiceFee int64 `json:"service_fee"`
165+
CommitFee int64 `json:"commit_fee"`
166+
CommitVsize int64 `json:"commit_vsize"`
167+
162168
CommitId string `json:"commit_id"`
163169
CommitPsbt string `json:"commit_psbt"`
164170
RevealTxs *base.StringArray `json:"reveal_txs"`
165171
RevealIds *base.StringArray `json:"reveal_ids"`
166172

167173
CommitCustom *Brc20CommitCustom `json:"commit_custom"`
168-
169-
NetworkFee int64 `json:"network_fee"`
170-
SatpointFee int64 `json:"satpoint_fee"`
171-
ServiceFee int64 `json:"service_fee"`
172-
CommitFee int64 `json:"commit_fee"`
173-
CommitVsize int64 `json:"commit_vsize"`
174174
}
175175
err = json.Unmarshal(resp.Body, &r)
176176
if err != nil {

core/btc/brc20_token.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -98,30 +98,30 @@ func (t *Brc20Token) FullTokenInfo() (info *Brc20TokenInfo, err error) {
9898
}
9999

100100
type Brc20TokenInfo struct {
101-
Ticker string `json:"ticker"`
102-
HoldersCount int64 `json:"holdersCount"`
103-
HistoryCount int64 `json:"historyCount"`
104-
InscriptionNumber int64 `json:"inscriptionNumber"`
105-
InscriptionId string `json:"inscriptionId"`
106-
Max string `json:"max"`
107-
Limit string `json:"limit"`
108-
Minted string `json:"minted"`
109-
TotalMinted string `json:"totalMinted"`
110-
ConfirmedMinted string `json:"confirmedMinted"`
111-
ConfirmedMinted1h string `json:"confirmedMinted1H"`
112-
ConfirmedMinted24h string `json:"confirmedMinted24H"`
113-
MintTimes int64 `json:"mintTimes"`
114-
Decimal int16 `json:"decimal"`
115-
Creator string `json:"creator"`
116-
Txid string `json:"txid"`
117-
DeployHeight int64 `json:"deployHeight"`
118-
DeployBlocktime int64 `json:"deployBlocktime"`
119-
CompleteHeight int64 `json:"completeHeight"`
120-
CompleteBlocktime int64 `json:"completeBlocktime"`
121-
InscriptionNumberStart int64 `json:"inscriptionNumberStart"`
122-
InscriptionNumberEnd int64 `json:"inscriptionNumberEnd"`
123-
124-
Price float64 `json:"price"`
101+
Price float64 `json:"price"`
102+
HoldersCount int64 `json:"holdersCount"`
103+
HistoryCount int64 `json:"historyCount"`
104+
InscriptionNumber int64 `json:"inscriptionNumber"`
105+
MintTimes int64 `json:"mintTimes"`
106+
DeployHeight int64 `json:"deployHeight"`
107+
DeployBlocktime int64 `json:"deployBlocktime"`
108+
CompleteHeight int64 `json:"completeHeight"`
109+
CompleteBlocktime int64 `json:"completeBlocktime"`
110+
InscriptionNumberStart int64 `json:"inscriptionNumberStart"`
111+
InscriptionNumberEnd int64 `json:"inscriptionNumberEnd"`
112+
113+
Ticker string `json:"ticker"`
114+
InscriptionId string `json:"inscriptionId"`
115+
Max string `json:"max"`
116+
Limit string `json:"limit"`
117+
Minted string `json:"minted"`
118+
TotalMinted string `json:"totalMinted"`
119+
ConfirmedMinted string `json:"confirmedMinted"`
120+
ConfirmedMinted1h string `json:"confirmedMinted1H"`
121+
ConfirmedMinted24h string `json:"confirmedMinted24H"`
122+
Decimal int16 `json:"decimal"`
123+
Creator string `json:"creator"`
124+
Txid string `json:"txid"`
125125
}
126126

127127
func (j *Brc20TokenInfo) JsonString() (*base.OptionalString, error) {

core/btc/brc20_transfer.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import (
1313
)
1414

1515
type Brc20TransferTransaction struct {
16-
Transaction string `json:"transaction"`
1716
NetworkFee int64 `json:"network_fee"`
18-
CommitId string `json:"commit_id"`
1917
CommitFee int64 `json:"commit_fee"`
2018
CommitVsize int64 `json:"commit_vsize"`
19+
Transaction string `json:"transaction"`
20+
CommitId string `json:"commit_id"`
2121

2222
CommitCustom *Brc20CommitCustom `json:"commit_custom"`
2323
}
@@ -82,12 +82,12 @@ func (c *Chain) BuildBrc20TransferTransaction(
8282
}
8383

8484
var r struct {
85-
Commit_id string `json:"commit_id"`
86-
Commit_psbt string `json:"commit_psbt"`
8785
Commit_fee int64 `json:"commit_fee"`
8886
Commit_vsize int64 `json:"commit_vsize"`
89-
Commit_custom *Brc20CommitCustom `json:"commit_custom"`
9087
Network_fee int64 `json:"network_fee"`
88+
Commit_id string `json:"commit_id"`
89+
Commit_psbt string `json:"commit_psbt"`
90+
Commit_custom *Brc20CommitCustom `json:"commit_custom"`
9191
}
9292
err = json.Unmarshal(resp.Body, &r)
9393
if err != nil {

core/btc/brc20_types.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ type rawBrc20TokenBalancePage struct {
6262
// - MARK -
6363

6464
type Brc20Inscription struct {
65-
InscriptionId string `json:"inscriptionId"`
6665
InscriptionNumber int64 `json:"inscriptionNumber"`
67-
Address string `json:"address"`
6866
OutputValue int64 `json:"outputValue"`
67+
ContentLength int64 `json:"contentLength"`
68+
Timestamp int64 `json:"timestamp"`
69+
InscriptionId string `json:"inscriptionId"`
70+
Address string `json:"address"`
6971
Preview string `json:"preview"`
7072
Content string `json:"content"`
71-
ContentLength int64 `json:"contentLength"`
7273
ContentType string `json:"contentType"`
7374
ContentBody string `json:"contentBody"`
74-
Timestamp int64 `json:"timestamp"`
7575
GenesisTransaction string `json:"genesisTransaction"`
7676
Location string `json:"location"`
7777
Output string `json:"output"`
@@ -141,8 +141,8 @@ func (bp *Brc20InscriptionPage) AsNFTPage() *NFTPage {
141141
}
142142

143143
type Brc20TransferableInscription struct {
144-
InscriptionId string `json:"inscriptionId"`
145144
InscriptionNumber int64 `json:"inscriptionNumber"`
145+
InscriptionId string `json:"inscriptionId"`
146146
Amount string `json:"amount"`
147147
Ticker string `json:"ticker"`
148148
Unconfirmed bool `json:"unconfirmed,omitempty"`
@@ -174,8 +174,8 @@ type unisatTokenSummary struct {
174174
}
175175

176176
type Brc20UTXO struct {
177-
Txid string `json:"txid"`
178177
Index int64 `json:"index"`
178+
Txid string `json:"txid"`
179179
}
180180

181181
func NewBrc20UTXO(txid string, index int64) *Brc20UTXO {

core/btc/transaction_decode.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ import (
1414
)
1515

1616
type TxOut struct {
17-
Hash string `json:"hash,omitempty"`
18-
Index int64 `json:"index,omitempty"`
19-
2017
Value int64 `json:"value,omitempty"`
18+
Index int64 `json:"index,omitempty"`
19+
Hash string `json:"hash,omitempty"`
2120
Address string `json:"address,omitempty"`
2221
}
2322

0 commit comments

Comments
 (0)