@bytexbyte/nxtlinq-ai-agent-sdk 1.6.30 → 1.6.31
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/components/context/ChatBotContext.d.ts.map +1 -1
- package/dist/components/context/ChatBotContext.js +7 -3
- package/dist/core/utils/aitUtils.js +1 -1
- package/dist/core/utils/ethersUtils.d.ts +8 -0
- package/dist/core/utils/ethersUtils.d.ts.map +1 -0
- package/dist/core/utils/ethersUtils.js +19 -0
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/core/utils/index.d.ts.map +1 -1
- package/dist/core/utils/index.js +1 -0
- package/dist/core/utils/walletUtils.d.ts +1 -1
- package/dist/core/utils/walletUtils.d.ts.map +1 -1
- package/dist/core/utils/walletUtils.js +5 -1
- package/package.json +3 -3
- package/umd/nxtlinq-ai-agent.umd.js +212 -92
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAosFlD,CAAC"}
|
|
@@ -9,7 +9,7 @@ import useSessionStorage from '../../core/lib/useSessionStorage';
|
|
|
9
9
|
import { useSpeechToTextFromMic } from '../../core/lib/useSpeechToTextFromMic';
|
|
10
10
|
import textToBuffer, { getDefaultSpeechToken } from '../../core/lib/textToSpeech';
|
|
11
11
|
import metakeepClient from '../../core/metakeepClient';
|
|
12
|
-
import { sleep } from '../../core/utils';
|
|
12
|
+
import { sleep, getEthers } from '../../core/utils';
|
|
13
13
|
import * as walletTextUtils from '../../core/utils/walletTextUtils';
|
|
14
14
|
const MIC_ENABLED_SESSION_KEY = 'chatbot-mic-enabled';
|
|
15
15
|
const ChatBotContext = React.createContext(undefined);
|
|
@@ -805,12 +805,15 @@ customError, }) => {
|
|
|
805
805
|
return;
|
|
806
806
|
}
|
|
807
807
|
try {
|
|
808
|
+
getEthers();
|
|
808
809
|
const web3Provider = await metakeepClient.ethereum;
|
|
809
810
|
if (!web3Provider) {
|
|
810
811
|
throw new Error('Web3 provider not available');
|
|
811
812
|
}
|
|
812
813
|
await web3Provider.enable();
|
|
813
|
-
|
|
814
|
+
// ethers v6: Use BrowserProvider instead of Web3Provider
|
|
815
|
+
const ethersProvider = new ethers.BrowserProvider(web3Provider);
|
|
816
|
+
// ethers v6: getSigner() and getAddress() are now async
|
|
814
817
|
const userSigner = await ethersProvider.getSigner();
|
|
815
818
|
const userAddress = await userSigner.getAddress();
|
|
816
819
|
localStorage.setItem('walletAddress', userAddress);
|
|
@@ -1996,7 +1999,8 @@ customError, }) => {
|
|
|
1996
1999
|
issuedBy: currentAddress,
|
|
1997
2000
|
};
|
|
1998
2001
|
const metadataStr = stringify(metadata);
|
|
1999
|
-
|
|
2002
|
+
// ethers v6: utils.keccak256 -> keccak256, utils.toUtf8Bytes -> toUtf8Bytes
|
|
2003
|
+
const metadataHash = ethers.keccak256(ethers.toUtf8Bytes(metadataStr));
|
|
2000
2004
|
const uploadResponse = await nxtlinqApi.metadata.createMetadata(metadata, nxtlinqAITServiceAccessToken || '');
|
|
2001
2005
|
if ('error' in uploadResponse) {
|
|
2002
2006
|
throw new Error(`Failed to upload metadata: ${uploadResponse.error}`);
|
|
@@ -12,7 +12,7 @@ export const createAITMetadata = (permissions, issuedBy) => {
|
|
|
12
12
|
};
|
|
13
13
|
export const generateMetadataHash = (metadata) => {
|
|
14
14
|
const metadataStr = stringify(metadata);
|
|
15
|
-
return ethers.
|
|
15
|
+
return ethers.keccak256(ethers.toUtf8Bytes(metadataStr));
|
|
16
16
|
};
|
|
17
17
|
export const prepareAITCreation = (address, permissions, serviceId, isFromAIAgent = false, parentAITId) => {
|
|
18
18
|
const aitId = generateAITId(address);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
/**
|
|
3
|
+
* Safely get ethers library instance
|
|
4
|
+
* Tries imported ethers first, then falls back to window.ethers
|
|
5
|
+
* @throws Error if ethers is not available
|
|
6
|
+
*/
|
|
7
|
+
export declare const getEthers: () => typeof ethers;
|
|
8
|
+
//# sourceMappingURL=ethersUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ethersUtils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/ethersUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAO,OAAO,MAgBnC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
/**
|
|
3
|
+
* Safely get ethers library instance
|
|
4
|
+
* Tries imported ethers first, then falls back to window.ethers
|
|
5
|
+
* @throws Error if ethers is not available
|
|
6
|
+
*/
|
|
7
|
+
export const getEthers = () => {
|
|
8
|
+
// Try to use the imported ethers first (most common case)
|
|
9
|
+
if (ethers && typeof ethers === 'object') {
|
|
10
|
+
return ethers;
|
|
11
|
+
}
|
|
12
|
+
// Fallback: try to get from global window object (in case client site provides it)
|
|
13
|
+
if (typeof window !== 'undefined' && window.ethers) {
|
|
14
|
+
return window.ethers;
|
|
15
|
+
}
|
|
16
|
+
// Provide error message
|
|
17
|
+
console.error('[Nxtlinq SDK] Failed to get ethers library');
|
|
18
|
+
throw new Error('ethers library is not properly loaded. Please ensure ethers v6 is available.');
|
|
19
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,qBAE/B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,qBAE/B,CAAA;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/core/utils/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
2
|
export interface WalletConnectionResult {
|
|
3
3
|
address: string;
|
|
4
|
-
signer: ethers.
|
|
4
|
+
signer: ethers.JsonRpcSigner;
|
|
5
5
|
}
|
|
6
6
|
export declare const connectWallet: () => Promise<WalletConnectionResult>;
|
|
7
7
|
export declare const disconnectWallet: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletUtils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/walletUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"walletUtils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/walletUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,QAAa,OAAO,CAAC,sBAAsB,CAwBpE,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,IAEnC,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAAO,MAAM,GAAG,IAElD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,iBAAiB,MAAM,KAAG,OAStE,CAAC"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
2
|
import metakeepClient from '../metakeepClient';
|
|
3
|
+
import { getEthers } from './ethersUtils';
|
|
3
4
|
export const connectWallet = async () => {
|
|
4
5
|
if (typeof window === 'undefined') {
|
|
5
6
|
throw new Error('Web3 is not available in server-side rendering');
|
|
6
7
|
}
|
|
8
|
+
getEthers();
|
|
7
9
|
const web3Provider = await metakeepClient.ethereum;
|
|
8
10
|
if (!web3Provider) {
|
|
9
11
|
throw new Error('Web3 provider not available');
|
|
10
12
|
}
|
|
11
13
|
await web3Provider.enable();
|
|
12
|
-
|
|
14
|
+
// ethers v6: Use BrowserProvider instead of Web3Provider
|
|
15
|
+
const ethersProvider = new ethers.BrowserProvider(web3Provider);
|
|
16
|
+
// ethers v6: getSigner() and getAddress() are now async
|
|
13
17
|
const signer = await ethersProvider.getSigner();
|
|
14
18
|
const address = await signer.getAddress();
|
|
15
19
|
localStorage.setItem('walletAddress', address);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytexbyte/nxtlinq-ai-agent-sdk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.31",
|
|
4
4
|
"description": "Nxtlinq AI Agent SDK - Proprietary Software with enhanced async operation handling",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"@emotion/styled": "^11.14.1",
|
|
53
53
|
"@mui/icons-material": "^7.2.0",
|
|
54
54
|
"@mui/material": "^7.2.0",
|
|
55
|
-
"ethers": "
|
|
56
|
-
"json-stable-stringify": "^1.0
|
|
55
|
+
"ethers": "^6.16.0",
|
|
56
|
+
"fast-json-stable-stringify": "^2.1.0",
|
|
57
57
|
"metakeep": "^2.2.8",
|
|
58
58
|
"microsoft-cognitiveservices-speech-sdk": "^1.45.0",
|
|
59
59
|
"universal-cookie": "^8.0.1",
|