Skip to content

Commit

Permalink
refactor(types): using pactus amount data type (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy authored Apr 4, 2024
1 parent ed040a7 commit fb0bec6
Show file tree
Hide file tree
Showing 17 changed files with 208 additions and 5,716 deletions.
16 changes: 13 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ go 1.21.5

require (
github.com/ethereum/go-ethereum v1.13.14
github.com/pactus-project/pactus v1.0.2
github.com/pactus-project/pactus v1.0.1-0.20240404174554-d68f43459d48
github.com/stretchr/testify v1.9.0
google.golang.org/grpc v1.62.1
google.golang.org/protobuf v1.32.0
)

require (
github.com/NathanBaulch/protoc-gen-cobra v1.2.1 // indirect
github.com/iancoleman/strcase v0.2.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)

require (
Expand All @@ -28,7 +38,7 @@ require (
github.com/glebarez/go-sqlite v1.21.2 // indirect
github.com/glebarez/sqlite v1.11.0
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
Expand Down
175 changes: 160 additions & 15 deletions go.sum

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion sides/pactus/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/PACZone/wrapto/types/bypass"
"github.com/PACZone/wrapto/types/message"
"github.com/pactus-project/pactus/types/amount"
)

type Bridge struct {
Expand Down Expand Up @@ -39,7 +40,11 @@ func (b Bridge) ProcessMsg(msg message.Message) error {

payload := msg.Payload

amt := int64(payload.Amount())
amt, err := amount.NewAmount(payload.Amount())
if err != nil {
return err
}

memo := fmt.Sprintf("bridge from %s to %s by Wraptor.app", msg.From, msg.To)

_, err = b.wallet.TransferTransaction(payload.Receiver, memo, amt) // TODO: update order
Expand Down
8 changes: 0 additions & 8 deletions sides/pactus/buf/buf.gen.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion sides/pactus/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package pactus
import (
"context"

pactus "github.com/PACZone/wrapto/sides/pactus/gen/go"
pactus "github.com/pactus-project/pactus/www/grpc/gen/go"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
Expand Down
Loading

0 comments on commit fb0bec6

Please sign in to comment.