@subwallet/extension-base 1.1.13-0 → 1.1.14-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.
@@ -149,7 +149,7 @@ const createTransferExtrinsic = async _ref => {
149
149
  } else if (value) {
150
150
  transfer = api.tx.tokens.transfer(to, (0, _utils2._getTokenOnChainInfo)(tokenInfo) || (0, _utils2._getTokenOnChainAssetId)(tokenInfo), new _util.BN(value));
151
151
  }
152
- } else if (_constants._TRANSFER_CHAIN_GROUP.pendulum.includes(networkKey) && isTxTokensSupported) {
152
+ } else if (_constants._TRANSFER_CHAIN_GROUP.pendulum.includes(networkKey) && isTxTokensSupported && !(0, _utils2._isNativeToken)(tokenInfo)) {
153
153
  if (transferAll) {
154
154
  transfer = api.tx.tokens.transferAll(to, (0, _utils2._getTokenOnChainInfo)(tokenInfo), false);
155
155
  } else if (value) {
@@ -3141,17 +3141,22 @@ class KoniExtension {
3141
3141
  }
3142
3142
 
3143
3143
  // ChainService -------------------------------------------------
3144
- subscribeChainInfoMap(id, port) {
3144
+ async subscribeChainInfoMap(id, port) {
3145
3145
  const cb = (0, _subscriptions.createSubscription)(id, port);
3146
+ let ready = false;
3146
3147
  const chainInfoMapSubscription = this.#koniState.subscribeChainInfoMap().subscribe({
3147
3148
  next: rs => {
3148
- cb(rs);
3149
+ if (ready) {
3150
+ cb(rs);
3151
+ }
3149
3152
  }
3150
3153
  });
3151
3154
  this.createUnsubscriptionHandle(id, chainInfoMapSubscription.unsubscribe);
3152
3155
  port.onDisconnect.addListener(() => {
3153
3156
  this.cancelSubscription(id);
3154
3157
  });
3158
+ await this.#koniState.eventService.waitChainReady;
3159
+ ready = true;
3155
3160
  return this.#koniState.getChainInfoMap();
3156
3161
  }
3157
3162
  subscribeChainStateMap(id, port) {
@@ -3167,17 +3172,22 @@ class KoniExtension {
3167
3172
  });
3168
3173
  return this.#koniState.getChainStateMap();
3169
3174
  }
3170
- subscribeAssetRegistry(id, port) {
3175
+ async subscribeAssetRegistry(id, port) {
3171
3176
  const cb = (0, _subscriptions.createSubscription)(id, port);
3177
+ let ready = false;
3172
3178
  const assetRegistrySubscription = this.#koniState.subscribeAssetRegistry().subscribe({
3173
3179
  next: rs => {
3174
- cb(rs);
3180
+ if (ready) {
3181
+ cb(rs);
3182
+ }
3175
3183
  }
3176
3184
  });
3177
3185
  this.createUnsubscriptionHandle(id, assetRegistrySubscription.unsubscribe);
3178
3186
  port.onDisconnect.addListener(() => {
3179
3187
  this.cancelSubscription(id);
3180
3188
  });
3189
+ await this.#koniState.eventService.waitAssetReady;
3190
+ ready = true;
3181
3191
  return this.#koniState.getAssetRegistry();
3182
3192
  }
3183
3193
  subscribeMultiChainAssetMap(id, port) {
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@subwallet/extension-base',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '1.1.13-0'
16
+ version: '1.1.14-1'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -207,7 +207,7 @@ const _TRANSFER_CHAIN_GROUP = {
207
207
  riochain: ['riochain'],
208
208
  sora_substrate: ['sora_substrate'],
209
209
  avail: ['kate'],
210
- pendulum: ['pendulum']
210
+ pendulum: ['pendulum', 'amplitude', 'amplitude_test']
211
211
  };
212
212
  exports._TRANSFER_CHAIN_GROUP = _TRANSFER_CHAIN_GROUP;
213
213
  const _BALANCE_PARSING_CHAIN_GROUP = {
@@ -140,7 +140,7 @@ export const createTransferExtrinsic = async ({
140
140
  } else if (value) {
141
141
  transfer = api.tx.tokens.transfer(to, _getTokenOnChainInfo(tokenInfo) || _getTokenOnChainAssetId(tokenInfo), new BN(value));
142
142
  }
143
- } else if (_TRANSFER_CHAIN_GROUP.pendulum.includes(networkKey) && isTxTokensSupported) {
143
+ } else if (_TRANSFER_CHAIN_GROUP.pendulum.includes(networkKey) && isTxTokensSupported && !_isNativeToken(tokenInfo)) {
144
144
  if (transferAll) {
145
145
  transfer = api.tx.tokens.transferAll(to, _getTokenOnChainInfo(tokenInfo), false);
146
146
  } else if (value) {
@@ -3056,17 +3056,22 @@ export default class KoniExtension {
3056
3056
  }
3057
3057
 
3058
3058
  // ChainService -------------------------------------------------
3059
- subscribeChainInfoMap(id, port) {
3059
+ async subscribeChainInfoMap(id, port) {
3060
3060
  const cb = createSubscription(id, port);
3061
+ let ready = false;
3061
3062
  const chainInfoMapSubscription = this.#koniState.subscribeChainInfoMap().subscribe({
3062
3063
  next: rs => {
3063
- cb(rs);
3064
+ if (ready) {
3065
+ cb(rs);
3066
+ }
3064
3067
  }
3065
3068
  });
3066
3069
  this.createUnsubscriptionHandle(id, chainInfoMapSubscription.unsubscribe);
3067
3070
  port.onDisconnect.addListener(() => {
3068
3071
  this.cancelSubscription(id);
3069
3072
  });
3073
+ await this.#koniState.eventService.waitChainReady;
3074
+ ready = true;
3070
3075
  return this.#koniState.getChainInfoMap();
3071
3076
  }
3072
3077
  subscribeChainStateMap(id, port) {
@@ -3082,17 +3087,22 @@ export default class KoniExtension {
3082
3087
  });
3083
3088
  return this.#koniState.getChainStateMap();
3084
3089
  }
3085
- subscribeAssetRegistry(id, port) {
3090
+ async subscribeAssetRegistry(id, port) {
3086
3091
  const cb = createSubscription(id, port);
3092
+ let ready = false;
3087
3093
  const assetRegistrySubscription = this.#koniState.subscribeAssetRegistry().subscribe({
3088
3094
  next: rs => {
3089
- cb(rs);
3095
+ if (ready) {
3096
+ cb(rs);
3097
+ }
3090
3098
  }
3091
3099
  });
3092
3100
  this.createUnsubscriptionHandle(id, assetRegistrySubscription.unsubscribe);
3093
3101
  port.onDisconnect.addListener(() => {
3094
3102
  this.cancelSubscription(id);
3095
3103
  });
3104
+ await this.#koniState.eventService.waitAssetReady;
3105
+ ready = true;
3096
3106
  return this.#koniState.getAssetRegistry();
3097
3107
  }
3098
3108
  subscribeMultiChainAssetMap(id, port) {
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.1.13-0",
20
+ "version": "1.1.14-1",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -1227,10 +1227,10 @@
1227
1227
  "@sora-substrate/type-definitions": "^1.17.7",
1228
1228
  "@substrate/connect": "^0.7.26",
1229
1229
  "@subwallet/chain-list": "^0.2.14",
1230
- "@subwallet/extension-base": "^1.1.13-0",
1231
- "@subwallet/extension-chains": "^1.1.13-0",
1232
- "@subwallet/extension-dapp": "^1.1.13-0",
1233
- "@subwallet/extension-inject": "^1.1.13-0",
1230
+ "@subwallet/extension-base": "^1.1.14-1",
1231
+ "@subwallet/extension-chains": "^1.1.14-1",
1232
+ "@subwallet/extension-dapp": "^1.1.14-1",
1233
+ "@subwallet/extension-inject": "^1.1.14-1",
1234
1234
  "@subwallet/keyring": "^0.1.1",
1235
1235
  "@subwallet/ui-keyring": "^0.1.1",
1236
1236
  "@walletconnect/sign-client": "^2.8.4",
@@ -1249,7 +1249,7 @@
1249
1249
  "ethereumjs-util": "^7.1.5",
1250
1250
  "ethers": "^6.4.2",
1251
1251
  "eventemitter3": "^5.0.0",
1252
- "graphql": "^16.6.0",
1252
+ "graphql": "^16.8.1",
1253
1253
  "i18next": "^21.9.2",
1254
1254
  "is-buffer": "^2.0.5",
1255
1255
  "json-rpc-engine": "^6.1.0",
package/packageInfo.js CHANGED
@@ -7,5 +7,5 @@ export const packageInfo = {
7
7
  name: '@subwallet/extension-base',
8
8
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
9
9
  type: 'esm',
10
- version: '1.1.13-0'
10
+ version: '1.1.14-1'
11
11
  };
@@ -190,7 +190,7 @@ export const _TRANSFER_CHAIN_GROUP = {
190
190
  riochain: ['riochain'],
191
191
  sora_substrate: ['sora_substrate'],
192
192
  avail: ['kate'],
193
- pendulum: ['pendulum']
193
+ pendulum: ['pendulum', 'amplitude', 'amplitude_test']
194
194
  };
195
195
  export const _BALANCE_PARSING_CHAIN_GROUP = {
196
196
  bobabeam: ['bobabeam', 'bobabase']