Skip to content

Commit

Permalink
Merge pull request #410 from pranavkparti/transfer-request-claim
Browse files Browse the repository at this point in the history
fix: transfer request claim is optional parameter
  • Loading branch information
Kpoke authored Aug 27, 2023
2 parents 0d9aa72 + d9dce33 commit d74df33
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions server/handlers/transferHandler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ describe('transferRouter', () => {
tokens: ['1'],
sender_wallet: 'wallet1',
receiver_wallet: 'wallet2',
claim: false,
},
authenticatedWalletId,
),
Expand Down
4 changes: 2 additions & 2 deletions server/handlers/transferHandler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const {
} = require('./schemas');

const transferPost = async (req, res) => {
await transferPostSchema.validateAsync(req.body, { abortEarly: false });
const validatedData = await transferPostSchema.validateAsync(req.body, { abortEarly: false });
const transferService = new TransferService();

const { result, status } = await transferService.initiateTransfer(
req.body,
validatedData,
req.wallet_id,
);

Expand Down
5 changes: 2 additions & 3 deletions server/handlers/transferHandler/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ const transferPostSchema = Joi.alternatives()
tokens: Joi.array().items(Joi.string()).required().unique(),
sender_wallet: Joi.alternatives().try(Joi.string()).required(),
receiver_wallet: Joi.alternatives().try(Joi.string()).required(),
// TODO: add boolean for claim, but default to false.
claim: Joi.boolean(),
claim: Joi.boolean().default(false),
}),
otherwise: Joi.object({
bundle: Joi.object({
bundle_size: Joi.number().min(1).max(10000).integer(),
}).required(),
sender_wallet: Joi.string().required(),
receiver_wallet: Joi.string().required(),
claim: Joi.boolean().required(),
claim: Joi.boolean().default(false),
}),
},
);
Expand Down

0 comments on commit d74df33

Please sign in to comment.