Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/geth_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -2023,7 +2023,7 @@ func (b *GethStatusBackend) SendTransactionWithSignature(sendArgs wallettypes.Se
return hash, err
}

return b.transactor.SendTransactionWithSignature(common.Address(sendArgs.From), sendArgs.Symbol, sendArgs.MultiTransactionID, txWithSignature)
return b.transactor.SendTransactionWithSignature(common.Address(sendArgs.From), sendArgs.Symbol, txWithSignature)
}

// HashTransaction validate the transaction and returns new sendArgs and the transaction hash.
Expand Down
1 change: 0 additions & 1 deletion contracts/celer/bridge.abi

This file was deleted.

4,648 changes: 0 additions & 4,648 deletions contracts/celer/bridge.go

This file was deleted.

3 changes: 0 additions & 3 deletions contracts/celer/doc.go

This file was deleted.

3 changes: 0 additions & 3 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ type WalletConfig struct {
StatusProxyBlockchainPassword security.SensitiveString `json:"StatusProxyBlockchainPassword"`

StatusProxyStageName string `json:"StatusProxyStageName"`
EnableCelerBridge bool `json:"EnableCelerBridge"`
EnableMercuryoProvider bool `json:"EnableMercuryoProvider"`
EthRpcProxyUrl security.SensitiveString `json:"EthRpcProxyUrl"`
EthRpcProxyUser security.SensitiveString `json:"EthRpcProxyUser"`
Expand All @@ -249,13 +248,11 @@ type MarketDataProxyConfig struct {
func (wc WalletConfig) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Enabled bool `json:"Enabled"`
EnableCelerBridge bool `json:"EnableCelerBridge"`
EnableMercuryoProvider bool `json:"EnableMercuryoProvider"`
TokensListsAutoRefreshInterval int `json:"TokensListsAutoRefreshInterval"`
TokensListsAutoRefreshCheckInterval int `json:"TokensListsAutoRefreshCheckInterval"`
}{
Enabled: wc.Enabled,
EnableCelerBridge: wc.EnableCelerBridge,
EnableMercuryoProvider: wc.EnableMercuryoProvider,
TokensListsAutoRefreshInterval: wc.TokensListsAutoRefreshInterval,
TokensListsAutoRefreshCheckInterval: wc.TokensListsAutoRefreshCheckInterval,
Expand Down
3 changes: 0 additions & 3 deletions protocol/common/feature_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ type FeatureFlags struct {
// Peersyncing indicates whether we should advertise and sync messages with other peers
Peersyncing bool

// EnableCelerBridge indicates whether we should enable the Celer bridge in the Router
EnableCelerBridge bool

// EnableMercuryoProvider indicates whether we should enable the Mercuryo provider in the Wallet
EnableMercuryoProvider bool

Expand Down
49 changes: 0 additions & 49 deletions services/wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,50 +132,6 @@ Returns avaiable transfers in a given range.
]
```

### wallet_watchTransaction

Starts watching for transaction confirmation/rejection. If transaction was not confirmed/rejected in 10 minutes the call is timed out with error.

#### Parameters

- `tx-id`: `HEX` - transaction hash

#### Example

```json
{
"jsonrpc":"2.0",
"id":7,
"method":"wallet_watchTransaction",
"params":[
"0xaaaaaaaa11111112222233333333"
]
}
```

### wallet_watchTransactionByChainID

Starts watching for transaction confirmation/rejection. If transaction was not confirmed/rejected in 10 minutes the call is timed out with error.

#### Parameters

- `chainID`: `HEX` - ethereum chain id
- `tx-id`: `HEX` - transaction hash

#### Example

```json
{
"jsonrpc":"2.0",
"id":7,
"method":"wallet_watchTransactionByChainID",
"params":[
1,
"0xaaaaaaaa11111112222233333333"
]
}
```

### `wallet_checkRecentHistory`

#### Parameters
Expand Down Expand Up @@ -614,8 +570,3 @@ When a new multiaccount is created corresponding address will not contain any tr
1. Call `wallet_checkRecentHistory`
2. On `recent-history-ready` request transactions via `wallet_getTransfersByAddress`
3. Repeat `wallet_checkRecentHistory` in N minutes (currently 20 minutes in `status-mobile` for upstream RPC node. If a custom node is used interval can be arbitrary)

### Watching transaction
1. Call `wallet_watchTransaction`
2. On success call `wallet_checkRecentHistory`
3. On `recent-history-ready` request transactions via `wallet_getTransfersByAddress`
15 changes: 6 additions & 9 deletions services/wallet/activity/activity_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,11 @@ func dataToEntriesV2(deps FilterDependencies, data []*entryDataV2) ([]Entry, err
chainID := wCommon.ChainID(d.Path.FromChain.ChainID)

entry := Entry{
payloadType: ac.MultiTransactionPT, // Temporary, to keep compatibility with clients
id: d.TxArgs.MultiTransactionID,
transactions: []*ac.TransactionIdentity{
{
ChainID: chainID,
Hash: d.Tx.Hash(),
Address: d.RouteInputParams.AddrFrom,
},
payloadType: ac.SimpleTransactionPT,
transaction: &ac.TransactionIdentity{
ChainID: chainID,
Hash: d.Tx.Hash(),
Address: d.RouteInputParams.AddrFrom,
},
timestamp: d.Timestamp,
activityType: getActivityTypeV2(d.Path.ProcessorName, d.IsApproval),
Expand Down Expand Up @@ -241,7 +238,7 @@ func getActivityTypeV2(processorName string, isApproval bool) ac.Type {
switch processorName {
case pathProcessorCommon.ProcessorTransferName, pathProcessorCommon.ProcessorERC721Name, pathProcessorCommon.ProcessorERC1155Name:
return ac.SendAT
case pathProcessorCommon.ProcessorBridgeHopName, pathProcessorCommon.ProcessorBridgeCelerName:
case pathProcessorCommon.ProcessorBridgeHopName:
return ac.BridgeAT
case pathProcessorCommon.ProcessorSwapParaswapName:
return ac.SwapAT
Expand Down
44 changes: 21 additions & 23 deletions services/wallet/activity/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,29 +90,27 @@ type Token struct {
}

type EntryData struct {
PayloadType PayloadType `json:"payloadType"`
Key string `json:"key"`
Transaction *TransactionIdentity `json:"transaction,omitempty"`
ID *common.MultiTransactionIDType `json:"id,omitempty"`
Transactions []*TransactionIdentity `json:"transactions,omitempty"`
Timestamp *int64 `json:"timestamp,omitempty"`
ActivityType *Type `json:"activityType,omitempty"`
ActivityStatus *Status `json:"activityStatus,omitempty"`
AmountOut *hexutil.Big `json:"amountOut,omitempty"`
AmountIn *hexutil.Big `json:"amountIn,omitempty"`
TokenOut *Token `json:"tokenOut,omitempty"`
TokenIn *Token `json:"tokenIn,omitempty"`
SymbolOut *string `json:"symbolOut,omitempty"`
SymbolIn *string `json:"symbolIn,omitempty"`
Sender *eth.Address `json:"sender,omitempty"`
Recipient *eth.Address `json:"recipient,omitempty"`
ChainIDOut *common.ChainID `json:"chainIdOut,omitempty"`
ChainIDIn *common.ChainID `json:"chainIdIn,omitempty"`
TransferType *TransferType `json:"transferType,omitempty"`
ContractAddress *eth.Address `json:"contractAddress,omitempty"`
CommunityID *string `json:"communityId,omitempty"`
InteractedContractAddress *eth.Address `json:"interactedContractAddress,omitempty"`
ApprovalSpender *eth.Address `json:"approvalSpender,omitempty"`
PayloadType PayloadType `json:"payloadType"`
Key string `json:"key"`
Transaction *TransactionIdentity `json:"transaction,omitempty"`
Timestamp *int64 `json:"timestamp,omitempty"`
ActivityType *Type `json:"activityType,omitempty"`
ActivityStatus *Status `json:"activityStatus,omitempty"`
AmountOut *hexutil.Big `json:"amountOut,omitempty"`
AmountIn *hexutil.Big `json:"amountIn,omitempty"`
TokenOut *Token `json:"tokenOut,omitempty"`
TokenIn *Token `json:"tokenIn,omitempty"`
SymbolOut *string `json:"symbolOut,omitempty"`
SymbolIn *string `json:"symbolIn,omitempty"`
Sender *eth.Address `json:"sender,omitempty"`
Recipient *eth.Address `json:"recipient,omitempty"`
ChainIDOut *common.ChainID `json:"chainIdOut,omitempty"`
ChainIDIn *common.ChainID `json:"chainIdIn,omitempty"`
TransferType *TransferType `json:"transferType,omitempty"`
ContractAddress *eth.Address `json:"contractAddress,omitempty"`
CommunityID *string `json:"communityId,omitempty"`
InteractedContractAddress *eth.Address `json:"interactedContractAddress,omitempty"`
ApprovalSpender *eth.Address `json:"approvalSpender,omitempty"`

IsNew *bool `json:"isNew,omitempty"`

Expand Down
15 changes: 5 additions & 10 deletions services/wallet/activity/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,12 @@ func (s *Service) getActivityDetails(ctx context.Context, entries []Entry) ([]*a
}
for _, e := range entryList {
data := &ac.EntryData{
Key: e.Key(),
NftName: nftName,
NftURL: nftURL,
Key: e.Key(),
NftName: nftName,
NftURL: nftURL,
Transaction: e.transaction,
PayloadType: e.payloadType,
}
if e.payloadType == ac.MultiTransactionPT {
data.ID = w_common.NewAndSet(e.id)
} else {
data.Transaction = e.transaction
}

data.PayloadType = e.payloadType
res = append(res, data)
}
}
Expand Down
6 changes: 2 additions & 4 deletions services/wallet/activity/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,22 @@ const nilStr = "nil"
type EntryIdentity struct {
payloadType ac.PayloadType
transaction *ac.TransactionIdentity
id common.MultiTransactionIDType
}

func (e EntryIdentity) same(a EntryIdentity) bool {
return a.payloadType == e.payloadType &&
((a.transaction == nil && e.transaction == nil) ||
(a.transaction.ChainID == e.transaction.ChainID &&
a.transaction.Hash == e.transaction.Hash &&
a.transaction.Address == e.transaction.Address)) &&
a.id == e.id
a.transaction.Address == e.transaction.Address))
}

func (e EntryIdentity) key() string {
txID := nilStr
if e.transaction != nil {
txID = strconv.FormatUint(uint64(e.transaction.ChainID), 10) + e.transaction.Hash.Hex() + e.transaction.Address.Hex()
}
return strconv.Itoa(e.payloadType) + txID + strconv.FormatInt(int64(e.id), 16)
return strconv.Itoa(e.payloadType) + txID
}

type SessionID int32
Expand Down
24 changes: 4 additions & 20 deletions services/wallet/activity/session_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func mirrorIdentities(entries []Entry) []EntryIdentity {
model = append(model, EntryIdentity{
payloadType: a.payloadType,
transaction: a.transaction,
id: a.id,
})
}
return model
Expand Down Expand Up @@ -261,7 +260,6 @@ func (s *Service) GetMoreForFilterSession(id SessionID, pageCount int) error {
session.model = append(session.model, EntryIdentity{
payloadType: a.payloadType,
transaction: a.transaction,
id: a.id,
})
}

Expand Down Expand Up @@ -404,7 +402,7 @@ func (s *Service) processChangesForSession(session *Session, eventCount int, cha
Entry: &entry,
})
// Insert in session model at modelPos index
session.model = append(session.model[:modelPos], append([]EntryIdentity{{payloadType: entry.payloadType, transaction: entry.transaction, id: entry.id}}, session.model[modelPos:]...)...)
session.model = append(session.model[:modelPos], append([]EntryIdentity{{payloadType: entry.payloadType, transaction: entry.transaction}}, session.model[modelPos:]...)...)
}
}

Expand All @@ -425,17 +423,7 @@ func (s *Service) processEntryDataUpdates(sessionID SessionID, entries []Entry,

entriesMap := make(map[string]Entry, len(entries))
for _, e := range entries {
if e.payloadType == ac.MultiTransactionPT {
if e.id != common.NoMultiTransactionID {
for _, tx := range e.transactions {
id := TransactionID{
ChainID: tx.ChainID,
Hash: tx.Hash,
}
entriesMap[id.key()] = e
}
}
} else if e.transaction != nil {
if e.transaction != nil {
id := TransactionID{
ChainID: e.transaction.ChainID,
Hash: e.transaction.Hash,
Expand All @@ -453,13 +441,9 @@ func (s *Service) processEntryDataUpdates(sessionID SessionID, entries []Entry,
data := &ac.EntryData{
Key: e.Key(),
ActivityStatus: &e.activityStatus,
Transaction: e.transaction,
PayloadType: e.payloadType,
}
if e.payloadType == ac.MultiTransactionPT {
data.ID = common.NewAndSet(e.id)
} else {
data.Transaction = e.transaction
}
data.PayloadType = e.payloadType

updateData = append(updateData, data)
}
Expand Down
39 changes: 22 additions & 17 deletions services/wallet/activity/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ func TestFindUpdates(t *testing.T) {
Hash: eth.HexToHash("0x1234"),
Address: eth.HexToAddress("0x1234"),
},
ac.TransactionIdentity{
ChainID: 1,
Hash: eth.HexToHash("0x5678"),
Address: eth.HexToAddress("0x5678"),
},
}

type findUpdatesResult struct {
Expand All @@ -31,13 +36,13 @@ func TestFindUpdates(t *testing.T) {
want findUpdatesResult
}{
{
name: "Empty to single MT update",
name: "Empty to single transaction update",
identities: []EntryIdentity{},
updated: []Entry{
{payloadType: ac.MultiTransactionPT, id: 1},
{payloadType: ac.SimpleTransactionPT, transaction: &txIds[0]},
},
want: findUpdatesResult{
new: []mixedIdentityResult{{0, EntryIdentity{payloadType: ac.MultiTransactionPT, id: 1}}},
new: []mixedIdentityResult{{0, EntryIdentity{payloadType: ac.SimpleTransactionPT, transaction: &txIds[0]}}},
},
},
{
Expand All @@ -56,43 +61,43 @@ func TestFindUpdates(t *testing.T) {
name: "Empty to mixed updates",
identities: []EntryIdentity{},
updated: []Entry{
{payloadType: ac.MultiTransactionPT, id: 1},
{payloadType: ac.PendingTransactionPT, transaction: &txIds[0]},
{payloadType: ac.SimpleTransactionPT, transaction: &txIds[0]},
{payloadType: ac.PendingTransactionPT, transaction: &txIds[1]},
},
want: findUpdatesResult{
new: []mixedIdentityResult{{0, EntryIdentity{payloadType: ac.MultiTransactionPT, id: 1}},
{1, EntryIdentity{payloadType: ac.PendingTransactionPT, transaction: &txIds[0]}},
new: []mixedIdentityResult{{0, EntryIdentity{payloadType: ac.SimpleTransactionPT, transaction: &txIds[0]}},
{1, EntryIdentity{payloadType: ac.PendingTransactionPT, transaction: &txIds[1]}},
},
},
},
{
name: "Add one on top of one",
identities: []EntryIdentity{
EntryIdentity{
payloadType: ac.MultiTransactionPT, id: 1,
payloadType: ac.SimpleTransactionPT, transaction: &txIds[0],
},
},
updated: []Entry{
{payloadType: ac.PendingTransactionPT, transaction: &txIds[0]},
{payloadType: ac.MultiTransactionPT, id: 1},
{payloadType: ac.PendingTransactionPT, transaction: &txIds[1]},
{payloadType: ac.SimpleTransactionPT, transaction: &txIds[0]},
},
want: findUpdatesResult{
new: []mixedIdentityResult{{0, EntryIdentity{payloadType: ac.PendingTransactionPT, transaction: &txIds[0]}}},
new: []mixedIdentityResult{{0, EntryIdentity{payloadType: ac.PendingTransactionPT, transaction: &txIds[1]}}},
},
},
{
name: "Add one on top keep window",
identities: []EntryIdentity{
EntryIdentity{payloadType: ac.MultiTransactionPT, id: 1},
EntryIdentity{payloadType: ac.PendingTransactionPT, transaction: &txIds[0]},
EntryIdentity{payloadType: ac.SimpleTransactionPT, transaction: &txIds[0]},
EntryIdentity{payloadType: ac.PendingTransactionPT, transaction: &txIds[1]},
},
updated: []Entry{
{payloadType: ac.MultiTransactionPT, id: 2},
{payloadType: ac.MultiTransactionPT, id: 1},
{payloadType: ac.SimpleTransactionPT, transaction: &txIds[1]},
{payloadType: ac.SimpleTransactionPT, transaction: &txIds[0]},
},
want: findUpdatesResult{
new: []mixedIdentityResult{{0, EntryIdentity{payloadType: ac.MultiTransactionPT, id: 2}}},
removed: []EntryIdentity{EntryIdentity{payloadType: ac.PendingTransactionPT, transaction: &txIds[0]}},
new: []mixedIdentityResult{{0, EntryIdentity{payloadType: ac.SimpleTransactionPT, transaction: &txIds[1]}}},
removed: []EntryIdentity{EntryIdentity{payloadType: ac.PendingTransactionPT, transaction: &txIds[1]}},
},
},
}
Expand Down
Loading
Loading