11import {
2- ASSETS_MAINNET ,
32 bfToDecimal ,
43 Fraction ,
4+ getAssetMeta ,
55 KaminoLendingPolicy ,
66 PkMap ,
77 PkSet ,
@@ -278,11 +278,7 @@ export function installKaminoLendCommands(klend: Command, context: CliContext) {
278278 . option ( "-y, --yes" , "Skip confirmation prompt" , false )
279279 . description ( "Deposit to Kamino Lending market" )
280280 . action ( async ( market , asset , amount , options ) => {
281- const decimals = ASSETS_MAINNET . get ( asset ) ?. decimals ;
282- if ( ! decimals ) {
283- console . error ( `Asset ${ asset } not supported` ) ;
284- process . exit ( 1 ) ;
285- }
281+ const { decimals } = getAssetMeta ( asset ) ;
286282
287283 await executeTxWithErrorHandling (
288284 ( ) =>
@@ -308,11 +304,7 @@ export function installKaminoLendCommands(klend: Command, context: CliContext) {
308304 . option ( "-y, --yes" , "Skip confirmation prompt" , false )
309305 . description ( "Withdraw asset from Kamino Lending market" )
310306 . action ( async ( market , asset , amount , options ) => {
311- const decimals = ASSETS_MAINNET . get ( asset ) ?. decimals ;
312- if ( ! decimals ) {
313- console . error ( `Asset ${ asset } not supported` ) ;
314- process . exit ( 1 ) ;
315- }
307+ const { decimals } = getAssetMeta ( asset ) ;
316308
317309 await executeTxWithErrorHandling (
318310 ( ) =>
@@ -338,11 +330,7 @@ export function installKaminoLendCommands(klend: Command, context: CliContext) {
338330 . option ( "-y, --yes" , "Skip confirmation prompt" , false )
339331 . description ( "Borrow from Kamino Lending market" )
340332 . action ( async ( market , asset , amount , options ) => {
341- const decimals = ASSETS_MAINNET . get ( asset ) ?. decimals ;
342- if ( ! decimals ) {
343- console . error ( `Asset ${ asset } not supported` ) ;
344- process . exit ( 1 ) ;
345- }
333+ const { decimals } = getAssetMeta ( asset ) ;
346334
347335 await executeTxWithErrorHandling (
348336 ( ) =>
@@ -368,11 +356,7 @@ export function installKaminoLendCommands(klend: Command, context: CliContext) {
368356 . option ( "-y, --yes" , "Skip confirmation prompt" , false )
369357 . description ( "Repay loan from Kamino Lending market" )
370358 . action ( async ( market , asset , amount , options ) => {
371- const decimals = ASSETS_MAINNET . get ( asset ) ?. decimals ;
372- if ( ! decimals ) {
373- console . error ( `Asset ${ asset } not supported` ) ;
374- process . exit ( 1 ) ;
375- }
359+ const { decimals } = getAssetMeta ( asset ) ;
376360
377361 await executeTxWithErrorHandling (
378362 ( ) =>
0 commit comments