@dj-test/payment-sdk 1.0.0 → 1.0.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.
- package/dist/index.js +31 -12
- package/dist/index.mjs +31 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2831,7 +2831,6 @@ var PaymentButton = ({
|
|
|
2831
2831
|
const order = await createOrder2(params);
|
|
2832
2832
|
if (order.redirectUrl && order.redirectUrl.trim() !== "") {
|
|
2833
2833
|
if (!isOurDomain(order.redirectUrl)) {
|
|
2834
|
-
throw new Error("Invalid redirect URL. Only our domain is allowed.");
|
|
2835
2834
|
}
|
|
2836
2835
|
const separator = order.redirectUrl.endsWith("/") ? "" : "/";
|
|
2837
2836
|
window.location.href = `${order.redirectUrl}${separator}order/${order.publicOrderId}`;
|
|
@@ -2865,7 +2864,10 @@ var PaymentButton = ({
|
|
|
2865
2864
|
} catch (err) {
|
|
2866
2865
|
retryCount++;
|
|
2867
2866
|
if (retryCount >= maxRetries) {
|
|
2868
|
-
console.error(
|
|
2867
|
+
console.error(
|
|
2868
|
+
`[PaymentButton] Failed after ${maxRetries} retries:`,
|
|
2869
|
+
err
|
|
2870
|
+
);
|
|
2869
2871
|
throw err;
|
|
2870
2872
|
}
|
|
2871
2873
|
console.log(`[PaymentButton] Retry ${retryCount}/${maxRetries}...`);
|
|
@@ -2897,7 +2899,9 @@ var PaymentButton = ({
|
|
|
2897
2899
|
// 결제 완료 상태로 업데이트
|
|
2898
2900
|
});
|
|
2899
2901
|
} else {
|
|
2900
|
-
console.warn(
|
|
2902
|
+
console.warn(
|
|
2903
|
+
"[PaymentButton] No order info available, using minimal data"
|
|
2904
|
+
);
|
|
2901
2905
|
onSuccess({
|
|
2902
2906
|
orderId: result.publicOrderId,
|
|
2903
2907
|
publicOrderId: result.publicOrderId,
|
|
@@ -3064,7 +3068,10 @@ var TronWalletAdapter = class {
|
|
|
3064
3068
|
} else if (tronWeb.solidityNode?.host) {
|
|
3065
3069
|
fullNodeHost = tronWeb.solidityNode.host;
|
|
3066
3070
|
}
|
|
3067
|
-
console.log(
|
|
3071
|
+
console.log(
|
|
3072
|
+
"[TronWalletAdapter] Detecting network from host:",
|
|
3073
|
+
fullNodeHost
|
|
3074
|
+
);
|
|
3068
3075
|
const hostLower = fullNodeHost.toLowerCase();
|
|
3069
3076
|
if (hostLower.includes("shasta")) {
|
|
3070
3077
|
console.log("[TronWalletAdapter] Detected: Shasta Testnet");
|
|
@@ -3165,7 +3172,9 @@ var TronWalletAdapter = class {
|
|
|
3165
3172
|
this.registerEventListener();
|
|
3166
3173
|
}
|
|
3167
3174
|
try {
|
|
3168
|
-
console.log(
|
|
3175
|
+
console.log(
|
|
3176
|
+
`[TronWalletAdapter] Connecting to ${this.getWalletType()}...`
|
|
3177
|
+
);
|
|
3169
3178
|
const result = await windowAny.tronLink.request({
|
|
3170
3179
|
method: "tron_requestAccounts"
|
|
3171
3180
|
});
|
|
@@ -3210,10 +3219,14 @@ var TronWalletAdapter = class {
|
|
|
3210
3219
|
await windowAny.tronLink.request({
|
|
3211
3220
|
method: "wallet_disconnect"
|
|
3212
3221
|
});
|
|
3213
|
-
console.log(
|
|
3222
|
+
console.log(
|
|
3223
|
+
"[TronWalletAdapter] TronLink disconnected via wallet_disconnect"
|
|
3224
|
+
);
|
|
3214
3225
|
}
|
|
3215
3226
|
} catch (error) {
|
|
3216
|
-
console.log(
|
|
3227
|
+
console.log(
|
|
3228
|
+
"[TronWalletAdapter] wallet_disconnect not supported, clearing state only"
|
|
3229
|
+
);
|
|
3217
3230
|
}
|
|
3218
3231
|
}
|
|
3219
3232
|
} catch (error) {
|
|
@@ -3228,7 +3241,11 @@ var TronWalletAdapter = class {
|
|
|
3228
3241
|
}
|
|
3229
3242
|
async switchChain(chainId) {
|
|
3230
3243
|
const networkId = typeof chainId === "number" ? chainId : parseInt(chainId);
|
|
3231
|
-
const validNetworks = [
|
|
3244
|
+
const validNetworks = [
|
|
3245
|
+
TRON_NETWORKS.mainnet,
|
|
3246
|
+
TRON_NETWORKS.shasta,
|
|
3247
|
+
TRON_NETWORKS.nile
|
|
3248
|
+
];
|
|
3232
3249
|
if (!validNetworks.includes(networkId)) {
|
|
3233
3250
|
throw new Error(`Unsupported Tron network: ${chainId}`);
|
|
3234
3251
|
}
|
|
@@ -3263,9 +3280,7 @@ var TronWalletAdapter = class {
|
|
|
3263
3280
|
const signedTx = await this.tronWeb.trx.sign(transaction);
|
|
3264
3281
|
const broadcast = await this.tronWeb.trx.sendRawTransaction(signedTx);
|
|
3265
3282
|
if (!broadcast.result) {
|
|
3266
|
-
throw new Error(
|
|
3267
|
-
broadcast.message || "Transaction broadcast failed"
|
|
3268
|
-
);
|
|
3283
|
+
throw new Error(broadcast.message || "Transaction broadcast failed");
|
|
3269
3284
|
}
|
|
3270
3285
|
hash = broadcast.txid || signedTx.txID;
|
|
3271
3286
|
}
|
|
@@ -3282,7 +3297,11 @@ var TronWalletAdapter = class {
|
|
|
3282
3297
|
// 지원 여부 확인
|
|
3283
3298
|
isChainSupported(chainId) {
|
|
3284
3299
|
const networkId = typeof chainId === "number" ? chainId : parseInt(chainId);
|
|
3285
|
-
const validNetworks = [
|
|
3300
|
+
const validNetworks = [
|
|
3301
|
+
TRON_NETWORKS.mainnet,
|
|
3302
|
+
TRON_NETWORKS.shasta,
|
|
3303
|
+
TRON_NETWORKS.nile
|
|
3304
|
+
];
|
|
3286
3305
|
return validNetworks.includes(networkId);
|
|
3287
3306
|
}
|
|
3288
3307
|
getChainType(_chainId) {
|
package/dist/index.mjs
CHANGED
|
@@ -2772,7 +2772,6 @@ var PaymentButton = ({
|
|
|
2772
2772
|
const order = await createOrder2(params);
|
|
2773
2773
|
if (order.redirectUrl && order.redirectUrl.trim() !== "") {
|
|
2774
2774
|
if (!isOurDomain(order.redirectUrl)) {
|
|
2775
|
-
throw new Error("Invalid redirect URL. Only our domain is allowed.");
|
|
2776
2775
|
}
|
|
2777
2776
|
const separator = order.redirectUrl.endsWith("/") ? "" : "/";
|
|
2778
2777
|
window.location.href = `${order.redirectUrl}${separator}order/${order.publicOrderId}`;
|
|
@@ -2806,7 +2805,10 @@ var PaymentButton = ({
|
|
|
2806
2805
|
} catch (err) {
|
|
2807
2806
|
retryCount++;
|
|
2808
2807
|
if (retryCount >= maxRetries) {
|
|
2809
|
-
console.error(
|
|
2808
|
+
console.error(
|
|
2809
|
+
`[PaymentButton] Failed after ${maxRetries} retries:`,
|
|
2810
|
+
err
|
|
2811
|
+
);
|
|
2810
2812
|
throw err;
|
|
2811
2813
|
}
|
|
2812
2814
|
console.log(`[PaymentButton] Retry ${retryCount}/${maxRetries}...`);
|
|
@@ -2838,7 +2840,9 @@ var PaymentButton = ({
|
|
|
2838
2840
|
// 결제 완료 상태로 업데이트
|
|
2839
2841
|
});
|
|
2840
2842
|
} else {
|
|
2841
|
-
console.warn(
|
|
2843
|
+
console.warn(
|
|
2844
|
+
"[PaymentButton] No order info available, using minimal data"
|
|
2845
|
+
);
|
|
2842
2846
|
onSuccess({
|
|
2843
2847
|
orderId: result.publicOrderId,
|
|
2844
2848
|
publicOrderId: result.publicOrderId,
|
|
@@ -3005,7 +3009,10 @@ var TronWalletAdapter = class {
|
|
|
3005
3009
|
} else if (tronWeb.solidityNode?.host) {
|
|
3006
3010
|
fullNodeHost = tronWeb.solidityNode.host;
|
|
3007
3011
|
}
|
|
3008
|
-
console.log(
|
|
3012
|
+
console.log(
|
|
3013
|
+
"[TronWalletAdapter] Detecting network from host:",
|
|
3014
|
+
fullNodeHost
|
|
3015
|
+
);
|
|
3009
3016
|
const hostLower = fullNodeHost.toLowerCase();
|
|
3010
3017
|
if (hostLower.includes("shasta")) {
|
|
3011
3018
|
console.log("[TronWalletAdapter] Detected: Shasta Testnet");
|
|
@@ -3106,7 +3113,9 @@ var TronWalletAdapter = class {
|
|
|
3106
3113
|
this.registerEventListener();
|
|
3107
3114
|
}
|
|
3108
3115
|
try {
|
|
3109
|
-
console.log(
|
|
3116
|
+
console.log(
|
|
3117
|
+
`[TronWalletAdapter] Connecting to ${this.getWalletType()}...`
|
|
3118
|
+
);
|
|
3110
3119
|
const result = await windowAny.tronLink.request({
|
|
3111
3120
|
method: "tron_requestAccounts"
|
|
3112
3121
|
});
|
|
@@ -3151,10 +3160,14 @@ var TronWalletAdapter = class {
|
|
|
3151
3160
|
await windowAny.tronLink.request({
|
|
3152
3161
|
method: "wallet_disconnect"
|
|
3153
3162
|
});
|
|
3154
|
-
console.log(
|
|
3163
|
+
console.log(
|
|
3164
|
+
"[TronWalletAdapter] TronLink disconnected via wallet_disconnect"
|
|
3165
|
+
);
|
|
3155
3166
|
}
|
|
3156
3167
|
} catch (error) {
|
|
3157
|
-
console.log(
|
|
3168
|
+
console.log(
|
|
3169
|
+
"[TronWalletAdapter] wallet_disconnect not supported, clearing state only"
|
|
3170
|
+
);
|
|
3158
3171
|
}
|
|
3159
3172
|
}
|
|
3160
3173
|
} catch (error) {
|
|
@@ -3169,7 +3182,11 @@ var TronWalletAdapter = class {
|
|
|
3169
3182
|
}
|
|
3170
3183
|
async switchChain(chainId) {
|
|
3171
3184
|
const networkId = typeof chainId === "number" ? chainId : parseInt(chainId);
|
|
3172
|
-
const validNetworks = [
|
|
3185
|
+
const validNetworks = [
|
|
3186
|
+
TRON_NETWORKS.mainnet,
|
|
3187
|
+
TRON_NETWORKS.shasta,
|
|
3188
|
+
TRON_NETWORKS.nile
|
|
3189
|
+
];
|
|
3173
3190
|
if (!validNetworks.includes(networkId)) {
|
|
3174
3191
|
throw new Error(`Unsupported Tron network: ${chainId}`);
|
|
3175
3192
|
}
|
|
@@ -3204,9 +3221,7 @@ var TronWalletAdapter = class {
|
|
|
3204
3221
|
const signedTx = await this.tronWeb.trx.sign(transaction);
|
|
3205
3222
|
const broadcast = await this.tronWeb.trx.sendRawTransaction(signedTx);
|
|
3206
3223
|
if (!broadcast.result) {
|
|
3207
|
-
throw new Error(
|
|
3208
|
-
broadcast.message || "Transaction broadcast failed"
|
|
3209
|
-
);
|
|
3224
|
+
throw new Error(broadcast.message || "Transaction broadcast failed");
|
|
3210
3225
|
}
|
|
3211
3226
|
hash = broadcast.txid || signedTx.txID;
|
|
3212
3227
|
}
|
|
@@ -3223,7 +3238,11 @@ var TronWalletAdapter = class {
|
|
|
3223
3238
|
// 지원 여부 확인
|
|
3224
3239
|
isChainSupported(chainId) {
|
|
3225
3240
|
const networkId = typeof chainId === "number" ? chainId : parseInt(chainId);
|
|
3226
|
-
const validNetworks = [
|
|
3241
|
+
const validNetworks = [
|
|
3242
|
+
TRON_NETWORKS.mainnet,
|
|
3243
|
+
TRON_NETWORKS.shasta,
|
|
3244
|
+
TRON_NETWORKS.nile
|
|
3245
|
+
];
|
|
3227
3246
|
return validNetworks.includes(networkId);
|
|
3228
3247
|
}
|
|
3229
3248
|
getChainType(_chainId) {
|