11import { fromMemorySigner } from "@marigold-dev/deku" ;
22import { InMemorySigner } from "@taquito/signer" ;
3- import { Contract , DekuCClient } from "@marigold-dev/deku" ;
3+ import { Contract , DekuCClient , parseTicketAmount } from "@marigold-dev/deku" ;
44import { load } from "../core/wallet" ;
55import * as Commander from "commander" ;
66import { read , isLigo } from "../core/contract" ;
@@ -17,21 +17,28 @@ function getContract(apiUri, walletPath, contractAddress, ligoUri?) {
1717 return deku . contract ( contractAddress ) ;
1818}
1919
20+ function parseTicketAmounts ( args : string [ ] ) {
21+ return args . map ( ( str ) => {
22+ return parseTicketAmount ( str ) ;
23+ } ) ;
24+ }
25+
2026async function invokeMain (
2127 apiUri ,
2228 walletPath ,
2329 contractAddress ,
2430 parameter ,
31+ ticketAmounts ,
2532 options
2633) {
2734 try {
2835 const contract = getContract ( apiUri , walletPath , contractAddress ) ;
2936 if ( options . raw !== undefined ) {
3037 const parameter_parsed = JSON . parse ( parameter ) ;
31- const hash = await contract . invokeRaw ( parameter ) ;
38+ const hash = await contract . invokeRaw ( parameter , ticketAmounts ) ;
3239 console . log ( "Operation hash:" , hash ) ;
3340 } else {
34- const hash = await contract . invoke ( parameter ) ;
41+ const hash = await contract . invoke ( parameter , ticketAmounts ) ;
3542 console . log ( "operation hash:" , hash ) ;
3643 }
3744 } catch ( e ) {
@@ -88,8 +95,19 @@ export default function make(command: Commander.Command) {
8895 `URI of the deku API to use (default ${ default_ . api } )`
8996 )
9097 . action ( ( walletPath , contractAddress , parameter , options ) => {
98+ const unparsedArguments = invoke . args . slice ( 3 ) ;
99+ console . log ( "UNPARSED:" , unparsedArguments ) ;
91100 const apiUri = options . endpoint ?? default_ . api ;
92- invokeMain ( apiUri , walletPath , contractAddress , parameter , options ) ;
101+ const tickets = parseTicketAmounts ( unparsedArguments ) ;
102+
103+ invokeMain (
104+ apiUri ,
105+ walletPath ,
106+ contractAddress ,
107+ parameter ,
108+ tickets ,
109+ options
110+ ) ;
93111 } ) ;
94112
95113 invokeLigo
0 commit comments