@0xpolygonid/js-sdk 1.14.0 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -130,7 +130,7 @@ class PaymentHandler extends message_handler_1.AbstractMessageHandler {
130
130
  if (!paymentRequest.from) {
131
131
  throw new Error(`failed request. empty 'from' field`);
132
132
  }
133
- if (!paymentRequest.body?.payments?.length) {
133
+ if (!paymentRequest.body.payments?.length) {
134
134
  throw new Error(`failed request. no 'payments' in body`);
135
135
  }
136
136
  if (!ctx.paymentHandler) {
@@ -201,12 +201,12 @@ class PaymentHandler extends message_handler_1.AbstractMessageHandler {
201
201
  if (opts.paymentRequest.from !== payment.to) {
202
202
  throw new Error(`sender of the request is not a target of response - expected ${opts.paymentRequest.from}, given ${payment.to}`);
203
203
  }
204
- if (!payment.body?.payments.length) {
204
+ if (!payment.body.payments.length) {
205
205
  throw new Error(`failed request. empty 'payments' field in body`);
206
206
  }
207
207
  for (let i = 0; i < payment.body.payments.length; i++) {
208
- const p = payment.body?.payments[i];
209
- const paymentRequestData = opts.paymentRequest.body?.payments.find((r) => r.data.id === p.id);
208
+ const p = payment.body.payments[i];
209
+ const paymentRequestData = opts.paymentRequest.body.payments.find((r) => r.data.id === p.id);
210
210
  if (!paymentRequestData) {
211
211
  throw new Error(`can't find payment request for payment id ${p.id}`);
212
212
  }
@@ -102,7 +102,7 @@ export class PaymentHandler extends AbstractMessageHandler {
102
102
  if (!paymentRequest.from) {
103
103
  throw new Error(`failed request. empty 'from' field`);
104
104
  }
105
- if (!paymentRequest.body?.payments?.length) {
105
+ if (!paymentRequest.body.payments?.length) {
106
106
  throw new Error(`failed request. no 'payments' in body`);
107
107
  }
108
108
  if (!ctx.paymentHandler) {
@@ -173,12 +173,12 @@ export class PaymentHandler extends AbstractMessageHandler {
173
173
  if (opts.paymentRequest.from !== payment.to) {
174
174
  throw new Error(`sender of the request is not a target of response - expected ${opts.paymentRequest.from}, given ${payment.to}`);
175
175
  }
176
- if (!payment.body?.payments.length) {
176
+ if (!payment.body.payments.length) {
177
177
  throw new Error(`failed request. empty 'payments' field in body`);
178
178
  }
179
179
  for (let i = 0; i < payment.body.payments.length; i++) {
180
- const p = payment.body?.payments[i];
181
- const paymentRequestData = opts.paymentRequest.body?.payments.find((r) => r.data.id === p.id);
180
+ const p = payment.body.payments[i];
181
+ const paymentRequestData = opts.paymentRequest.body.payments.find((r) => r.data.id === p.id);
182
182
  if (!paymentRequestData) {
183
183
  throw new Error(`can't find payment request for payment id ${p.id}`);
184
184
  }
@@ -2,7 +2,7 @@ import { BasicMessage } from '../';
2
2
  import { PaymentRequestDataType, PaymentRequestType, PaymentType } from '../../../verifiable';
3
3
  /** @beta PaymentRequestMessage is struct the represents payment-request message */
4
4
  export type PaymentRequestMessage = BasicMessage & {
5
- body?: PaymentRequestMessageBody;
5
+ body: PaymentRequestMessageBody;
6
6
  };
7
7
  /** @beta PaymentRequestMessageBody is struct the represents body for payment-request */
8
8
  export type PaymentRequestMessageBody = {
@@ -24,15 +24,15 @@ export type PaymentRequestInfo = {
24
24
  export type PaymentRequestDataInfo = {
25
25
  type: PaymentRequestDataType;
26
26
  amount: string;
27
- id: number;
28
- chainId: number;
27
+ id: string;
28
+ chainId: string;
29
29
  address: string;
30
30
  currency: string;
31
31
  signature?: string;
32
32
  };
33
33
  /** @beta PaymentMessage is struct the represents payment message */
34
34
  export type PaymentMessage = BasicMessage & {
35
- body?: PaymentMessageBody;
35
+ body: PaymentMessageBody;
36
36
  };
37
37
  /** @beta PaymentMessageBody is struct the represents body for payment message */
38
38
  export type PaymentMessageBody = {
@@ -40,7 +40,7 @@ export type PaymentMessageBody = {
40
40
  };
41
41
  /** @beta PaymentInfo is struct the represents payment info for payment */
42
42
  export type PaymentInfo = {
43
- id: number;
43
+ id: string;
44
44
  type: PaymentType;
45
45
  paymentData: {
46
46
  txId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xpolygonid/js-sdk",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "description": "SDK to work with Polygon ID",
5
5
  "main": "dist/node/cjs/index.js",
6
6
  "module": "dist/node/esm/index.js",