payment-kit 1.25.4 → 1.25.5

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.
@@ -26,10 +26,19 @@ let cachedChainHost: string | null = null;
26
26
  */
27
27
  export async function getMigratedFromList(client: OcapClient): Promise<string[]> {
28
28
  // @ts-ignore - OcapClient has host property
29
- const chainHost = client.host || client.endpoint || 'unknown';
30
-
29
+ const chainHost = client?.config?.httpEndpoint || 'unknown';
31
30
  // If wallet address and chain host haven't changed, use cached value
32
- if (wallet.address === cachedWalletAddress && chainHost === cachedChainHost && cachedMigratedFrom !== null) {
31
+ if (
32
+ wallet.address === cachedWalletAddress &&
33
+ chainHost === cachedChainHost &&
34
+ cachedMigratedFrom &&
35
+ cachedMigratedFrom.length > 0
36
+ ) {
37
+ logger.info('wallet-migration: using cached migratedFrom list', {
38
+ walletAddress: wallet.address,
39
+ chainHost,
40
+ migratedFromCount: cachedMigratedFrom.length,
41
+ });
33
42
  return cachedMigratedFrom;
34
43
  }
35
44
 
@@ -40,13 +49,13 @@ export async function getMigratedFromList(client: OcapClient): Promise<string[]>
40
49
  cachedWalletAddress = wallet.address;
41
50
  cachedChainHost = chainHost;
42
51
 
43
- if (cachedMigratedFrom.length > 0) {
44
- logger.info('wallet-migration: loaded migratedFrom list', {
45
- walletAddress: wallet.address,
46
- chainHost,
47
- migratedFrom: cachedMigratedFrom,
48
- });
49
- }
52
+ logger.info('wallet-migration: loaded migratedFrom list', {
53
+ walletAddress: wallet.address,
54
+ chainHost,
55
+ migratedFromCount: cachedMigratedFrom.length,
56
+ migratedFrom: cachedMigratedFrom,
57
+ migratedTo: state?.migratedTo,
58
+ });
50
59
 
51
60
  return cachedMigratedFrom;
52
61
  } catch (err) {
@@ -96,11 +105,26 @@ export async function getDelegationAddressWithFallback({
96
105
  delegator,
97
106
  client,
98
107
  }: GetDelegationAddressParams): Promise<AddressWithFallbackResult | null> {
108
+ // @ts-ignore - OcapClient has host property
109
+ const chainHost = client?.config?.httpEndpoint || 'unknown';
110
+
111
+ logger.info('wallet-migration: getDelegationAddressWithFallback called', {
112
+ delegator,
113
+ storedAddress: storedAddress || null,
114
+ walletAddress: wallet.address,
115
+ chainHost,
116
+ });
117
+
99
118
  // 1. Check stored delegation_address first - but verify it has valid state
100
119
  if (storedAddress) {
101
120
  try {
102
121
  const { state: storedState } = await client.getDelegateState({ address: storedAddress });
103
122
  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
+ });
104
128
  return { address: storedAddress, needsBackfill: false, source: 'stored' };
105
129
  }
106
130
  logger.warn('wallet-migration: stored delegation address has no valid state, falling back', {
@@ -132,6 +156,12 @@ export async function getDelegationAddressWithFallback({
132
156
  opsCount: currentState?.ops?.length || 0,
133
157
  };
134
158
  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
+ });
135
165
  return { address: currentAddress, needsBackfill: true, source: 'current' };
136
166
  }
137
167
  } catch (err) {
@@ -189,6 +219,7 @@ export async function getDelegationAddressWithFallback({
189
219
  // Not found - log detailed search results
190
220
  logger.error('wallet-migration: no delegation found after full search', {
191
221
  delegator,
222
+ chainHost,
192
223
  currentWalletAddress: wallet.address,
193
224
  currentDelegationAddress: currentAddress,
194
225
  currentStateResult,
package/blocklet.yml CHANGED
@@ -14,7 +14,7 @@ repository:
14
14
  type: git
15
15
  url: git+https://github.com/blocklet/payment-kit.git
16
16
  specVersion: 1.2.8
17
- version: 1.25.4
17
+ version: 1.25.5
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.25.4",
3
+ "version": "1.25.5",
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.4",
63
- "@blocklet/payment-react": "1.25.4",
64
- "@blocklet/payment-vendor": "1.25.4",
62
+ "@blocklet/payment-broker-client": "1.25.5",
63
+ "@blocklet/payment-react": "1.25.5",
64
+ "@blocklet/payment-vendor": "1.25.5",
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.4",
135
+ "@blocklet/payment-types": "1.25.5",
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": "e551d0dd9b08432ff880a33d859fa9a00c8ff649"
182
+ "gitHead": "fc70dce73c8d46dd6cd7936d188d551316cd02db"
183
183
  }