payment-kit 1.25.5 → 1.25.6
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/api/src/libs/wallet-migration.ts +9 -32
- package/blocklet.yml +1 -1
- package/package.json +6 -6
|
@@ -34,11 +34,6 @@ export async function getMigratedFromList(client: OcapClient): Promise<string[]>
|
|
|
34
34
|
cachedMigratedFrom &&
|
|
35
35
|
cachedMigratedFrom.length > 0
|
|
36
36
|
) {
|
|
37
|
-
logger.info('wallet-migration: using cached migratedFrom list', {
|
|
38
|
-
walletAddress: wallet.address,
|
|
39
|
-
chainHost,
|
|
40
|
-
migratedFromCount: cachedMigratedFrom.length,
|
|
41
|
-
});
|
|
42
37
|
return cachedMigratedFrom;
|
|
43
38
|
}
|
|
44
39
|
|
|
@@ -49,13 +44,13 @@ export async function getMigratedFromList(client: OcapClient): Promise<string[]>
|
|
|
49
44
|
cachedWalletAddress = wallet.address;
|
|
50
45
|
cachedChainHost = chainHost;
|
|
51
46
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
47
|
+
if (cachedMigratedFrom.length > 0) {
|
|
48
|
+
logger.info('wallet-migration: loaded migratedFrom list', {
|
|
49
|
+
walletAddress: wallet.address,
|
|
50
|
+
chainHost,
|
|
51
|
+
migratedFrom: cachedMigratedFrom,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
59
54
|
|
|
60
55
|
return cachedMigratedFrom;
|
|
61
56
|
} catch (err) {
|
|
@@ -108,23 +103,11 @@ export async function getDelegationAddressWithFallback({
|
|
|
108
103
|
// @ts-ignore - OcapClient has host property
|
|
109
104
|
const chainHost = client?.config?.httpEndpoint || 'unknown';
|
|
110
105
|
|
|
111
|
-
logger.info('wallet-migration: getDelegationAddressWithFallback called', {
|
|
112
|
-
delegator,
|
|
113
|
-
storedAddress: storedAddress || null,
|
|
114
|
-
walletAddress: wallet.address,
|
|
115
|
-
chainHost,
|
|
116
|
-
});
|
|
117
|
-
|
|
118
106
|
// 1. Check stored delegation_address first - but verify it has valid state
|
|
119
107
|
if (storedAddress) {
|
|
120
108
|
try {
|
|
121
109
|
const { state: storedState } = await client.getDelegateState({ address: storedAddress });
|
|
122
110
|
if (storedState?.ops?.length > 0) {
|
|
123
|
-
logger.info('wallet-migration: found valid delegation at stored address', {
|
|
124
|
-
storedAddress,
|
|
125
|
-
delegator,
|
|
126
|
-
opsCount: storedState.ops.length,
|
|
127
|
-
});
|
|
128
111
|
return { address: storedAddress, needsBackfill: false, source: 'stored' };
|
|
129
112
|
}
|
|
130
113
|
logger.warn('wallet-migration: stored delegation address has no valid state, falling back', {
|
|
@@ -156,12 +139,6 @@ export async function getDelegationAddressWithFallback({
|
|
|
156
139
|
opsCount: currentState?.ops?.length || 0,
|
|
157
140
|
};
|
|
158
141
|
if (currentState?.ops?.length > 0) {
|
|
159
|
-
logger.info('wallet-migration: found valid delegation at current address', {
|
|
160
|
-
currentAddress,
|
|
161
|
-
delegator,
|
|
162
|
-
walletAddress: wallet.address,
|
|
163
|
-
opsCount: currentState.ops.length,
|
|
164
|
-
});
|
|
165
142
|
return { address: currentAddress, needsBackfill: true, source: 'current' };
|
|
166
143
|
}
|
|
167
144
|
} catch (err) {
|
|
@@ -380,8 +357,8 @@ export async function backfillDelegationAddress(subId: string, address: string):
|
|
|
380
357
|
|
|
381
358
|
// Backfill the address (only if arcblock payment_details exists with required fields)
|
|
382
359
|
const existingArcblock = subscription.payment_details?.arcblock;
|
|
383
|
-
if (!existingArcblock
|
|
384
|
-
logger.
|
|
360
|
+
if (!existingArcblock) {
|
|
361
|
+
logger.info('migration: cannot backfill delegation_address - missing arcblock payment_details', {
|
|
385
362
|
subscriptionId: subscription.id,
|
|
386
363
|
});
|
|
387
364
|
return false;
|
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.6",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev --open",
|
|
6
6
|
"prelint": "npm run types",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"@blocklet/error": "^0.3.5",
|
|
60
60
|
"@blocklet/js-sdk": "^1.17.8-beta-20260104-120132-cb5b1914",
|
|
61
61
|
"@blocklet/logger": "^1.17.8-beta-20260104-120132-cb5b1914",
|
|
62
|
-
"@blocklet/payment-broker-client": "1.25.
|
|
63
|
-
"@blocklet/payment-react": "1.25.
|
|
64
|
-
"@blocklet/payment-vendor": "1.25.
|
|
62
|
+
"@blocklet/payment-broker-client": "1.25.6",
|
|
63
|
+
"@blocklet/payment-react": "1.25.6",
|
|
64
|
+
"@blocklet/payment-vendor": "1.25.6",
|
|
65
65
|
"@blocklet/sdk": "^1.17.8-beta-20260104-120132-cb5b1914",
|
|
66
66
|
"@blocklet/ui-react": "^3.4.7",
|
|
67
67
|
"@blocklet/uploader": "^0.3.19",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"devDependencies": {
|
|
133
133
|
"@abtnode/types": "^1.17.8-beta-20260104-120132-cb5b1914",
|
|
134
134
|
"@arcblock/eslint-config-ts": "^0.3.3",
|
|
135
|
-
"@blocklet/payment-types": "1.25.
|
|
135
|
+
"@blocklet/payment-types": "1.25.6",
|
|
136
136
|
"@types/cookie-parser": "^1.4.9",
|
|
137
137
|
"@types/cors": "^2.8.19",
|
|
138
138
|
"@types/debug": "^4.1.12",
|
|
@@ -179,5 +179,5 @@
|
|
|
179
179
|
"parser": "typescript"
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
"gitHead": "
|
|
182
|
+
"gitHead": "8a1d87eed8aaa803f29b7c3c69652f2e0c467058"
|
|
183
183
|
}
|