-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Minh Huy Tran <huy@perun.network>
- Loading branch information
1 parent
f9e43d3
commit ba555aa
Showing
10 changed files
with
193 additions
and
491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright 2022 - See NOTICE file for copyright holders. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package client | ||
|
||
import ( | ||
wallet "github.com/perun-network/perun-polkadot-backend/wallet/sr25519" | ||
|
||
"perun.network/go-perun/wire" | ||
) | ||
|
||
// Address is a wrapper for wallet.Address. | ||
type Address struct { | ||
*wallet.Address | ||
} | ||
|
||
// NewAddress returns a new address. | ||
func NewAddress() *Address { | ||
return &Address{} | ||
} | ||
|
||
// Equal returns whether the two addresses are equal. | ||
func (a Address) Equal(b wire.Address) bool { | ||
bTyped, ok := b.(*Address) | ||
if !ok { | ||
panic("wrong type") | ||
} | ||
return a.Address.Equal(bTyped.Address) | ||
} | ||
|
||
// Cmp compares the byte representation of two addresses. For `a.Cmp(b)` | ||
// returns -1 if a < b, 0 if a == b, 1 if a > b. | ||
func (a Address) Cmp(b wire.Address) int { | ||
bTyped, ok := b.(*Address) | ||
if !ok { | ||
panic("wrong type") | ||
} | ||
return a.Address.Cmp(bTyped.Address) | ||
} | ||
|
||
// MarshalBinay returns the binary representation of the address. | ||
func (a Address) MarshalBinay() ([]byte, error) { | ||
return a.Address.MarshalBinary() | ||
} | ||
|
||
// UnmarshalBinary decodes the binary representation of the address. | ||
func (a *Address) UnmarshalBinary(data []byte) error { | ||
return a.Address.UnmarshalBinary(data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,43 @@ | ||
module perun.network/perun-examples/payment-channel | ||
|
||
go 1.20 | ||
go 1.21 | ||
|
||
toolchain go1.21.4 | ||
|
||
require ( | ||
github.com/centrifuge/go-substrate-rpc-client/v3 v3.0.2 | ||
github.com/perun-network/perun-polkadot-backend v0.0.0-20211122151932-1cf5c72ae46f | ||
github.com/centrifuge/go-substrate-rpc-client/v4 v4.2.1 | ||
github.com/perun-network/perun-polkadot-backend v0.2.1-0.20240411100708-029d9632b748 | ||
github.com/pkg/errors v0.9.1 | ||
perun.network/go-perun v0.8.0 | ||
perun.network/go-perun v0.10.6 | ||
) | ||
|
||
require ( | ||
github.com/ChainSafe/go-schnorrkel v0.0.0-20210318173838-ccb5cd955283 // indirect | ||
github.com/ChainSafe/go-schnorrkel v1.1.0 // indirect | ||
github.com/btcsuite/btcd v0.21.0-beta // indirect | ||
github.com/cespare/xxhash/v2 v2.1.2 // indirect | ||
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect | ||
github.com/cosmos/go-bip39 v1.0.0 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/deckarep/golang-set v1.7.1 // indirect | ||
github.com/decred/base58 v1.0.3 // indirect | ||
github.com/deckarep/golang-set v1.8.0 // indirect | ||
github.com/decred/base58 v1.0.4 // indirect | ||
github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect | ||
github.com/ethereum/go-ethereum v1.10.12 // indirect | ||
github.com/go-stack/stack v1.8.0 // indirect | ||
github.com/gorilla/websocket v1.4.2 // indirect | ||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect | ||
github.com/ethereum/go-ethereum v1.10.20 // indirect | ||
github.com/go-stack/stack v1.8.1 // indirect | ||
github.com/gorilla/websocket v1.5.0 // indirect | ||
github.com/gtank/merlin v0.1.1 // indirect | ||
github.com/gtank/ristretto255 v0.1.2 // indirect | ||
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect | ||
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect | ||
github.com/pierrec/xxHash v0.1.5 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/rs/cors v1.8.0 // indirect | ||
github.com/rs/cors v1.8.2 // indirect | ||
github.com/sirupsen/logrus v1.8.1 // indirect | ||
github.com/stretchr/testify v1.7.0 // indirect | ||
github.com/stretchr/testify v1.7.2 // indirect | ||
github.com/vedhavyas/go-subkey v1.0.2 // indirect | ||
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect | ||
github.com/vedhavyas/go-subkey/v2 v2.0.0 // indirect | ||
golang.org/x/crypto v0.7.0 // indirect | ||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect | ||
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect | ||
golang.org/x/sys v0.6.0 // indirect | ||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect | ||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
polycry.pt/poly-go v0.0.0-20220301085937-fb9d71b45a37 // indirect | ||
) |
Oops, something went wrong.