@@ -21,7 +21,7 @@ import (
2121 "github.com/hyperledger-labs/fabric-token-sdk/token/services/ttx"
2222 "github.com/hyperledger-labs/fabric-token-sdk/token/services/ttxdb"
2323 "github.com/hyperledger-labs/fabric-token-sdk/token/services/ttxdb/driver"
24- token2 "github.com/hyperledger-labs/fabric-token-sdk/token/token"
24+ "github.com/hyperledger-labs/fabric-token-sdk/token/token"
2525 . "github.com/onsi/gomega"
2626)
2727
@@ -131,9 +131,9 @@ func CheckBalance(network *integration.Infrastructure, id string, wallet string,
131131 b := & views.Balance {}
132132 common .JSONUnmarshal (res .([]byte ), b )
133133 Expect (b .Type ).To (BeEquivalentTo (typ ))
134- q , err := token2 .ToQuantity (b .Quantity , 64 )
134+ q , err := token .ToQuantity (b .Quantity , 64 )
135135 Expect (err ).NotTo (HaveOccurred ())
136- expectedQ := token2 .NewQuantityFromUInt64 (expected )
136+ expectedQ := token .NewQuantityFromUInt64 (expected )
137137 Expect (expectedQ .Cmp (q )).To (BeEquivalentTo (0 ), "[%s]!=[%s]" , expected , q )
138138}
139139
@@ -171,26 +171,26 @@ func CheckSpending(network *integration.Infrastructure, id string, wallet string
171171 Expect (spending ).To (Equal (expected ))
172172}
173173
174- func ListIssuerHistory (network * integration.Infrastructure , wallet string , typ string ) * token2 .IssuedTokens {
174+ func ListIssuerHistory (network * integration.Infrastructure , wallet string , typ string ) * token .IssuedTokens {
175175 res , err := network .Client ("issuer" ).CallView ("historyIssuedToken" , common .JSONMarshall (& views.ListIssuedTokens {
176176 Wallet : wallet ,
177177 TokenType : typ ,
178178 }))
179179 Expect (err ).NotTo (HaveOccurred ())
180180
181- issuedTokens := & token2 .IssuedTokens {}
181+ issuedTokens := & token .IssuedTokens {}
182182 common .JSONUnmarshal (res .([]byte ), issuedTokens )
183183 return issuedTokens
184184}
185185
186- func ListUnspentTokens (network * integration.Infrastructure , id string , wallet string , typ string ) * token2 .UnspentTokens {
186+ func ListUnspentTokens (network * integration.Infrastructure , id string , wallet string , typ string ) * token .UnspentTokens {
187187 res , err := network .Client (id ).CallView ("history" , common .JSONMarshall (& views.ListUnspentTokens {
188188 Wallet : wallet ,
189189 TokenType : typ ,
190190 }))
191191 Expect (err ).NotTo (HaveOccurred ())
192192
193- unspentTokens := & token2 .UnspentTokens {}
193+ unspentTokens := & token .UnspentTokens {}
194194 common .JSONUnmarshal (res .([]byte ), unspentTokens )
195195 return unspentTokens
196196}
@@ -231,7 +231,7 @@ func TransferCash(network *integration.Infrastructure, id string, wallet string,
231231 return ""
232232}
233233
234- func PrepareTransferCash (network * integration.Infrastructure , id string , wallet string , typ string , amount uint64 , receiver string , auditor string , tokenID * token2 .ID , expectedErrorMsgs ... string ) (string , []byte ) {
234+ func PrepareTransferCash (network * integration.Infrastructure , id string , wallet string , typ string , amount uint64 , receiver string , auditor string , tokenID * token .ID , expectedErrorMsgs ... string ) (string , []byte ) {
235235 transferInput := & views.Transfer {
236236 Auditor : auditor ,
237237 Wallet : wallet ,
@@ -240,7 +240,7 @@ func PrepareTransferCash(network *integration.Infrastructure, id string, wallet
240240 Recipient : network .Identity (receiver ),
241241 }
242242 if tokenID != nil {
243- transferInput .TokenIDs = []* token2 .ID {tokenID }
243+ transferInput .TokenIDs = []* token .ID {tokenID }
244244 }
245245 txBoxed , err := network .Client (id ).CallView ("prepareTransfer" , common .JSONMarshall (transferInput ))
246246 if len (expectedErrorMsgs ) == 0 {
@@ -322,7 +322,7 @@ func GetTransactionInfo(network *integration.Infrastructure, id string, txnId st
322322 return info
323323}
324324
325- func TransferCashByIDs (network * integration.Infrastructure , id string , wallet string , ids []* token2 .ID , amount uint64 , receiver string , auditor string , failToRelease bool , expectedErrorMsgs ... string ) string {
325+ func TransferCashByIDs (network * integration.Infrastructure , id string , wallet string , ids []* token .ID , amount uint64 , receiver string , auditor string , failToRelease bool , expectedErrorMsgs ... string ) string {
326326 txIDBoxed , err := network .Client (id ).CallView ("transfer" , common .JSONMarshall (& views.Transfer {
327327 Auditor : auditor ,
328328 Wallet : wallet ,
@@ -379,7 +379,7 @@ func RedeemCash(network *integration.Infrastructure, id string, wallet string, t
379379 Expect (network .Client ("auditor" ).IsTxFinal (common .JSONUnmarshalString (txid ))).NotTo (HaveOccurred ())
380380}
381381
382- func RedeemCashByIDs (network * integration.Infrastructure , id string , wallet string , ids []* token2 .ID , amount uint64 , auditor string ) {
382+ func RedeemCashByIDs (network * integration.Infrastructure , id string , wallet string , ids []* token .ID , amount uint64 , auditor string ) {
383383 txid , err := network .Client (id ).CallView ("redeem" , common .JSONMarshall (& views.Redeem {
384384 Auditor : auditor ,
385385 Wallet : wallet ,
@@ -450,33 +450,33 @@ func PruneInvalidUnspentTokens(network *integration.Infrastructure, ids ...strin
450450 eIDBoxed , err := network .Client (id ).CallView ("PruneInvalidUnspentTokens" , common .JSONMarshall (& views.PruneInvalidUnspentTokens {}))
451451 Expect (err ).NotTo (HaveOccurred ())
452452
453- var deleted []* token2 .ID
453+ var deleted []* token .ID
454454 common .JSONUnmarshal (eIDBoxed .([]byte ), & deleted )
455455 Expect (len (deleted )).To (BeZero ())
456456 }
457457}
458458
459- func ListVaultUnspentTokens (network * integration.Infrastructure , id string ) []* token2 .ID {
459+ func ListVaultUnspentTokens (network * integration.Infrastructure , id string ) []* token .ID {
460460 res , err := network .Client (id ).CallView ("ListVaultUnspentTokens" , common .JSONMarshall (& views.ListVaultUnspentTokens {}))
461461 Expect (err ).NotTo (HaveOccurred ())
462462
463- unspentTokens := & token2 .UnspentTokens {}
463+ unspentTokens := & token .UnspentTokens {}
464464 common .JSONUnmarshal (res .([]byte ), unspentTokens )
465465 count := unspentTokens .Count ()
466- var IDs []* token2 .ID
466+ var IDs []* token .ID
467467 for i := 0 ; i < count ; i ++ {
468468 tok := unspentTokens .At (i )
469469 IDs = append (IDs , tok .Id )
470470 }
471471 return IDs
472472}
473473
474- func CheckIfExistsInVault (network * integration.Infrastructure , id string , tokenIDs []* token2 .ID ) {
474+ func CheckIfExistsInVault (network * integration.Infrastructure , id string , tokenIDs []* token .ID ) {
475475 _ , err := network .Client (id ).CallView ("CheckIfExistsInVault" , common .JSONMarshall (& views.CheckIfExistsInVault {IDs : tokenIDs }))
476476 Expect (err ).NotTo (HaveOccurred ())
477477}
478478
479- func WhoDeletedToken (network * integration.Infrastructure , id string , tokenIDs []* token2 .ID , txIDs ... string ) * views.WhoDeletedTokenResult {
479+ func WhoDeletedToken (network * integration.Infrastructure , id string , tokenIDs []* token .ID , txIDs ... string ) * views.WhoDeletedTokenResult {
480480 boxed , err := network .Client (id ).CallView ("WhoDeletedToken" , common .JSONMarshall (& views.WhoDeletedToken {
481481 TokenIDs : tokenIDs ,
482482 }))
@@ -544,4 +544,14 @@ func RegisterIssuerWallet(network *integration.Infrastructure, id string, wallet
544544 Path : walletPath ,
545545 }))
546546 Expect (err ).NotTo (HaveOccurred ())
547+ network .Ctx .SetViewClient (walletPath , network .Client (id ))
548+ }
549+
550+ func RegisterOwnerWallet (network * integration.Infrastructure , id string , walletID , walletPath string ) {
551+ _ , err := network .Client (id ).CallView ("RegisterOwnerWallet" , common .JSONMarshall (& views.RegisterOwnerWallet {
552+ ID : walletID ,
553+ Path : walletPath ,
554+ }))
555+ Expect (err ).NotTo (HaveOccurred ())
556+ network .Ctx .SetViewClient (walletID , network .Client (id ))
547557}
0 commit comments