@alephium/web3 1.2.1 → 1.2.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.
|
@@ -154,10 +154,10 @@ class NodeProvider {
|
|
|
154
154
|
};
|
|
155
155
|
this.guessStdTokenType = async (tokenId) => {
|
|
156
156
|
const interfaceId = await this.guessStdInterfaceId(tokenId);
|
|
157
|
-
switch (
|
|
158
|
-
case types_1.StdInterfaceIds.FungibleToken:
|
|
157
|
+
switch (true) {
|
|
158
|
+
case interfaceId?.startsWith(types_1.StdInterfaceIds.FungibleToken):
|
|
159
159
|
return 'fungible';
|
|
160
|
-
case types_1.StdInterfaceIds.NFT:
|
|
160
|
+
case interfaceId?.startsWith(types_1.StdInterfaceIds.NFT):
|
|
161
161
|
return 'non-fungible';
|
|
162
162
|
default:
|
|
163
163
|
return undefined;
|
package/dist/src/api/utils.js
CHANGED
|
@@ -21,8 +21,8 @@ exports.isBalanceEqual = exports.convertHttpResponse = void 0;
|
|
|
21
21
|
require("cross-fetch/polyfill");
|
|
22
22
|
function convertHttpResponse(response) {
|
|
23
23
|
if (response.error) {
|
|
24
|
-
const errorMessage = response.error.detail ?? `
|
|
25
|
-
throw new Error(`[API Error] - ${errorMessage}`);
|
|
24
|
+
const errorMessage = response.error.detail ?? `Unknown error`;
|
|
25
|
+
throw new Error(`[API Error] - ${errorMessage} - Status code: ${response.status}`);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
28
|
return response.data;
|
package/package.json
CHANGED
package/src/api/node-provider.ts
CHANGED
|
@@ -236,10 +236,10 @@ export class NodeProvider implements NodeProviderApis {
|
|
|
236
236
|
|
|
237
237
|
guessStdTokenType = async (tokenId: HexString): Promise<'fungible' | 'non-fungible' | undefined> => {
|
|
238
238
|
const interfaceId = await this.guessStdInterfaceId(tokenId)
|
|
239
|
-
switch (
|
|
240
|
-
case StdInterfaceIds.FungibleToken:
|
|
239
|
+
switch (true) {
|
|
240
|
+
case interfaceId?.startsWith(StdInterfaceIds.FungibleToken):
|
|
241
241
|
return 'fungible'
|
|
242
|
-
case StdInterfaceIds.NFT:
|
|
242
|
+
case interfaceId?.startsWith(StdInterfaceIds.NFT):
|
|
243
243
|
return 'non-fungible'
|
|
244
244
|
default:
|
|
245
245
|
return undefined
|
package/src/api/utils.ts
CHANGED
|
@@ -21,8 +21,8 @@ import * as node from '../api/api-alephium'
|
|
|
21
21
|
|
|
22
22
|
export function convertHttpResponse<T>(response: { status: number; data: T; error?: { detail: string } }): T {
|
|
23
23
|
if (response.error) {
|
|
24
|
-
const errorMessage = response.error.detail ?? `
|
|
25
|
-
throw new Error(`[API Error] - ${errorMessage}`)
|
|
24
|
+
const errorMessage = response.error.detail ?? `Unknown error`
|
|
25
|
+
throw new Error(`[API Error] - ${errorMessage} - Status code: ${response.status}`)
|
|
26
26
|
} else {
|
|
27
27
|
return response.data
|
|
28
28
|
}
|