@coin-voyage/shared 2.3.2 → 2.3.3
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.
- package/dist/api/client.js +20 -2
- package/dist/common/address.js +1 -1
- package/dist/types/api.d.ts +1 -0
- package/package.json +1 -1
package/dist/api/client.js
CHANGED
|
@@ -174,8 +174,26 @@ export class ApiClient {
|
|
|
174
174
|
*/
|
|
175
175
|
async createRefundPayOrder(payOrderId, params, apiSecret) {
|
|
176
176
|
try {
|
|
177
|
-
const
|
|
178
|
-
|
|
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`;
|
|
188
|
+
const signature = this.generateAuthorizationSignature(apiSecret, "POST", path);
|
|
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 {
|
package/dist/common/address.js
CHANGED
|
@@ -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) {
|
package/dist/types/api.d.ts
CHANGED