File tree Expand file tree Collapse file tree
modules/sdk-coin-canton/src/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -152,4 +152,5 @@ export interface CantonTransferRequest {
152152 expiryEpoch : number ;
153153 sendViaOneStep : boolean ;
154154 memoId ?: string ;
155+ token ?: string ;
155156}
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ export class TransferBuilder extends TransactionBuilder {
1313 private _sendOneStep = false ;
1414 private _expiryEpoch : number ;
1515 private _memoId : string ;
16+ private _token : string ;
1617 constructor ( _coinConfig : Readonly < CoinConfig > ) {
1718 super ( _coinConfig ) ;
1819 }
@@ -145,6 +146,20 @@ export class TransferBuilder extends TransactionBuilder {
145146 return this ;
146147 }
147148
149+ /**
150+ * Sets the optional token field if present, used for canton token transaction
151+ * @param name - the bitgo name of the token
152+ * @returns The current builder for chaining
153+ * @throws Error if name is invalid
154+ */
155+ token ( name : string ) : this {
156+ if ( ! name || ! name . trim ( ) ) {
157+ throw new Error ( 'token name must be a non-empty string' ) ;
158+ }
159+ this . _token = name . trim ( ) ;
160+ return this ;
161+ }
162+
148163 /**
149164 * Get the canton transfer request object
150165 * @returns CantonTransferRequest
@@ -163,6 +178,9 @@ export class TransferBuilder extends TransactionBuilder {
163178 if ( this . _memoId ) {
164179 data . memoId = this . _memoId ;
165180 }
181+ if ( this . _token ) {
182+ data . token = this . _token ;
183+ }
166184 return data ;
167185 }
168186
You can’t perform that action at this time.
0 commit comments