Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sidecar-client-chain33
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
sidecar-client-chain33
Commits
76d22115
Commit
76d22115
authored
Nov 15, 2021
by
harrylee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update chain33-go-sdk dep
parent
6fc82c43
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
16 deletions
+23
-16
client.go
client.go
+20
-15
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-0
No files found.
client.go
View file @
76d22115
...
...
@@ -19,6 +19,7 @@ import (
broker
"gitlab.33.cn/link33/chain33-sdk-go/dapp/broker"
"gitlab.33.cn/link33/chain33-sdk-go/event"
"gitlab.33.cn/link33/chain33-sdk-go/util"
"gitlab.33.cn/link33/chain33-sdk-go/types"
)
var
logger
=
hclog
.
New
(
&
hclog
.
LoggerOptions
{
...
...
@@ -381,14 +382,15 @@ func (c *Client) InvokeInterchain(from string, index uint64, destAddr string, re
// TODO 这里应该是getOutMessage可以获取跨链交易的txhash,通过查看库跨链交易的存在性证明来判断此笔跨链交易是否存在
func
(
c
*
Client
)
GetOutMessage
(
servicePair
string
,
idx
uint64
)
(
*
pb
.
IBTP
,
error
)
{
// 获取txhash
res
,
err
:=
c
.
consumer
.
jsonClient
.
QueryOutMessage
(
servicePair
,
idx
)
proof
,
err
:=
c
.
getProof
(
res
.
Message
)
event
,
err
:=
c
.
consumer
.
jsonClient
.
QueryOutMessage
(
servicePair
,
idx
)
if
err
!=
nil
{
return
nil
,
err
}
response
:=
&
Response
{
true
,
res
.
Message
,
res
.
Payload
}
return
c
.
unpackIBTP
(
response
,
pb
.
IBTP_INTERCHAIN
,
proof
)
//proof, err := c.getProof(res.Message)
//if err != nil {
// return nil, err
//}
return
c
.
unpackIBTP
(
event
,
pb
.
IBTP_INTERCHAIN
,
nil
)
}
// FIXME 查看跨入交易的执行结果,是否执行成功
...
...
@@ -398,7 +400,7 @@ func (c *Client) GetInMessage(servicePair string, index uint64) ([][]byte, error
return
nil
,
fmt
.
Errorf
(
"execute QueryInMessage: %w"
,
err
)
}
results
:=
[]
string
{
"true"
}
results
=
append
(
results
,
strings
.
Split
(
string
(
response
.
Payload
),
","
)
...
)
results
=
append
(
results
,
strings
.
Split
(
string
(
response
.
Status
),
","
)
...
)
return
util
.
ToChaincodeArgs
(
results
...
),
nil
}
...
...
@@ -527,11 +529,8 @@ func (c *Client) GetReceipt(ibtp *pb.IBTP) (*pb.IBTP, error) {
// 更新索引,正确执行的,执行失败的
func
(
c
*
Client
)
InvokeIndexUpdate
(
from
string
,
index
uint64
,
serviceId
string
,
category
pb
.
IBTP_Category
)
(
string
,
*
Response
,
error
)
{
// types.Response{Message:}
tx
,
err
:=
broker
.
UpdateIndex
(
""
,
from
,
serviceId
,
index
,
uint64
(
category
),
nil
)
if
err
!=
nil
{
return
""
,
nil
,
err
}
// TODO 状态更新怎么说得 status 1表示执行成功
tx
:=
broker
.
UpdateIndex
(
""
,
from
,
serviceId
,
index
,
uint64
(
category
),
1
)
response
,
err
:=
c
.
consumer
.
jsonClient
.
SendTransactionSync
(
c
.
config
.
Chain33
.
PrivateKey
,
tx
)
if
err
!=
nil
{
return
""
,
nil
,
err
...
...
@@ -579,11 +578,17 @@ func (c *Client) GetChainID() (string, string) {
return
info
.
GetBxhId
(),
info
.
GetAppChainId
()
}
func
(
c
*
Client
)
unpackIBTP
(
response
*
Response
,
ibtpType
pb
.
IBTP_Type
,
proof
[]
byte
)
(
*
pb
.
IBTP
,
error
)
{
func
(
c
*
Client
)
unpackIBTP
(
event
*
types
.
InterchainEvent
,
ibtpType
pb
.
IBTP_Type
,
proof
[]
byte
)
(
*
pb
.
IBTP
,
error
)
{
ret
:=
&
Event
{}
if
err
:=
json
.
Unmarshal
(
response
.
Data
,
ret
);
err
!=
nil
{
return
nil
,
err
}
//TODO 序列化这里要适配plugin中的序列化方式
ret
.
Argsrb
=
event
.
Argsrb
ret
.
Args
=
event
.
Args
ret
.
Argscb
=
event
.
Argscb
ret
.
Index
=
event
.
GetIndex
()
ret
.
Func
=
event
.
Func
ret
.
DstFullID
=
event
.
GetDstServiceID
()
ret
.
SrcFullID
=
event
.
GetSrcServiceID
()
ibtp
:=
ret
.
Convert2IBTP
(
c
.
timeoutHeight
,
ibtpType
)
ibtp
.
Proof
=
proof
return
ibtp
,
nil
...
...
go.mod
View file @
76d22115
...
...
@@ -8,7 +8,7 @@ require (
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd
github.com/hashicorp/go-plugin v1.3.0
github.com/spf13/viper v1.7.0
gitlab.33.cn/link33/chain33-sdk-go v0.0.0-202111
09083921-bd668bac2a45
gitlab.33.cn/link33/chain33-sdk-go v0.0.0-202111
15064655-8b3cd52918d4
gitlab.33.cn/link33/sidecar v0.0.0-20211105031147-f9e9df1e4f1f
)
...
...
go.sum
View file @
76d22115
...
...
@@ -812,6 +812,8 @@ gitlab.33.cn/link33/chain33-sdk-go v0.0.0-20211026072656-659d145568bf h1:bU0i+pv
gitlab.33.cn/link33/chain33-sdk-go v0.0.0-20211026072656-659d145568bf/go.mod h1:UCLBolS9ETAR94H+RgdkR9n5XpU7A0zPecmokb7bkfk=
gitlab.33.cn/link33/chain33-sdk-go v0.0.0-20211109083921-bd668bac2a45 h1:fZIzcFqIsbgDIQ9TR6QxxtV0e7/z3B6YYvdfIBz8lBg=
gitlab.33.cn/link33/chain33-sdk-go v0.0.0-20211109083921-bd668bac2a45/go.mod h1:UCLBolS9ETAR94H+RgdkR9n5XpU7A0zPecmokb7bkfk=
gitlab.33.cn/link33/chain33-sdk-go v0.0.0-20211115064655-8b3cd52918d4 h1:ms1tZDf9kUzkxqoxnJtyv0c6zGEONloIUhKokZqrnGM=
gitlab.33.cn/link33/chain33-sdk-go v0.0.0-20211115064655-8b3cd52918d4/go.mod h1:UCLBolS9ETAR94H+RgdkR9n5XpU7A0zPecmokb7bkfk=
gitlab.33.cn/link33/sidecar v0.0.0-20211028080238-67f4248825bb h1:L1SK4l+DMV2WhKkifYr3cW9hxHU/bDQ/XAO7SZ1S94U=
gitlab.33.cn/link33/sidecar v0.0.0-20211028080238-67f4248825bb/go.mod h1:s/qrfybcmaH6VguLhze6/iyNE7pCJKVKndLaN37vqOs=
gitlab.33.cn/link33/sidecar v0.0.0-20211104022541-aeda6e51e6aa h1:DXloOgq8p/rrFr9tXZFj/BmgyW5DZ1SKWfskZFF5jOk=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment