@coin-voyage/shared 2.3.2 → 2.3.3-beta.0

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.
@@ -174,8 +174,26 @@ export class ApiClient {
174
174
  */
175
175
  async createRefundPayOrder(payOrderId, params, apiSecret) {
176
176
  try {
177
+ const result = zPayOrder.safeParse(params);
178
+ if (!result.success) {
179
+ throw new Error(result.error.issues.map((e) => e.message).join(", "));
180
+ }
181
+ if (params.metadata) {
182
+ const result = zPayOrderMetadata.safeParse(params.metadata);
183
+ if (!result.success) {
184
+ throw new Error(result.error.issues.map((e) => e.message).join(", "));
185
+ }
186
+ }
187
+ const path = `/pay-orders/${payOrderId}/refund`;
177
188
  const signature = this.generateAuthorizationSignature(apiSecret, "POST", `/pay-orders/${payOrderId}/refund`);
178
- return this.createPayOrder(params, PayOrderMode.REFUND, signature);
189
+ return this.request({
190
+ path,
191
+ options: {
192
+ method: "POST",
193
+ body: JSON.stringify({ ...params }),
194
+ headers: { Authorization: signature },
195
+ },
196
+ });
179
197
  }
180
198
  catch (error) {
181
199
  return {
@@ -31,7 +31,7 @@ export const isBitcoinAddress = (address) => {
31
31
  };
32
32
  export const isEthereumAddress = (addr) => /^0x[a-fA-F0-9]{40}$/.test(addr);
33
33
  export const isSolanaAddress = (addr) => /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(addr);
34
- export const isSuiAddress = (addr) => /^0x[a-fA-F0-9]{64}$/.test(addr);
34
+ export const isSuiAddress = (addr) => /^0x[a-fA-F0-9]{1,64}$/.test(addr);
35
35
  export const isTronAddress = (addr) => /^T[1-9A-HJ-NP-Za-km-z]{33}$/.test(addr);
36
36
  export const isValidAddress = (addr, chain) => {
37
37
  switch (chain) {
@@ -65,6 +65,7 @@ export type GetFeeBalancesResponse = FeeBalance;
65
65
  export type ClaimFeesRequest = {
66
66
  currency: CurrencyBase;
67
67
  recipient: string;
68
+ metadata?: PayOrderMetadata;
68
69
  };
69
70
  export type ClaimFeesResponse = {
70
71
  transaction_hash: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coin-voyage/shared",
3
3
  "description": "Shared utilities for Coin Voyage",
4
- "version": "2.3.2",
4
+ "version": "2.3.3-beta.0",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {