diff --git a/src/index.ts b/src/index.ts index b5b78dc..ede51bf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,6 +12,7 @@ import { quarksToKin, TransactionType, PublicKey, + Memo, } from '@kinecosystem/kin-sdk-v2'; import { @@ -348,11 +349,25 @@ async function submitPayment({ req, res }: AsyncRequest) { const quarks = kinToQuarks(amount); const typeEnum = getTypeEnum(type); + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + const string = 'Str must be 29 chars or less.'; + let foreignKey = Buffer.alloc(29); + if (string) { + foreignKey = Buffer.from(string); + } + console.log('🚀 ~ foreignKey length', foreignKey.toString().length); + + const memo = Memo.new(1, typeEnum, 360, foreignKey).buffer.toString( + 'base64' + ); + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + const paymentObject: Payment = { sender, destination, quarks, type: typeEnum, + memo, }; const buffer = await kinClient.submitPayment(paymentObject);