@sogni-ai/sogni-client 4.2.0-alpha.21 → 4.2.0-alpha.22
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/CHANGELOG.md +7 -0
- package/CLAUDE.md +7 -0
- package/README.md +45 -25
- package/dist/Chat/ChatTools.js +30 -16
- package/dist/Chat/ChatTools.js.map +1 -1
- package/dist/Chat/hostedToolValidation.generated.d.ts +46 -0
- package/dist/Chat/hostedToolValidation.generated.js +306 -0
- package/dist/Chat/hostedToolValidation.generated.js.map +1 -0
- package/dist/Chat/index.d.ts +41 -1
- package/dist/Chat/index.js +166 -2
- package/dist/Chat/index.js.map +1 -1
- package/dist/Chat/modelRouting.d.ts +8 -26
- package/dist/Chat/modelRouting.js +11 -106
- package/dist/Chat/modelRouting.js.map +1 -1
- package/dist/Chat/sogniHostedTools.generated.json +1285 -283
- package/dist/Chat/tools.d.ts +52 -3
- package/dist/Chat/tools.js +80 -27
- package/dist/Chat/tools.js.map +1 -1
- package/dist/Chat/types.d.ts +119 -3
- package/dist/CreativeWorkflows/index.d.ts +1 -7
- package/dist/CreativeWorkflows/index.js +23 -21
- package/dist/CreativeWorkflows/index.js.map +1 -1
- package/dist/CreativeWorkflows/types.d.ts +27 -33
- package/dist/index.d.ts +19 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/Cache.js +6 -1
- package/dist/lib/Cache.js.map +1 -1
- package/dist-esm/Account/CurrentAccount.js +59 -0
- package/dist-esm/Account/CurrentAccount.js.map +1 -0
- package/dist-esm/Account/index.js +543 -0
- package/dist-esm/Account/index.js.map +1 -0
- package/dist-esm/Account/types.js +2 -0
- package/dist-esm/Account/types.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js +327 -0
- package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/ChannelCoordinator.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js +222 -0
- package/dist-esm/ApiClient/WebSocketClient/BrowserWebSocketClient/index.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/ErrorCode.js +15 -0
- package/dist-esm/ApiClient/WebSocketClient/ErrorCode.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/eventSubscriptions.js +35 -0
- package/dist-esm/ApiClient/WebSocketClient/eventSubscriptions.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/events.js +2 -0
- package/dist-esm/ApiClient/WebSocketClient/events.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/index.js +221 -0
- package/dist-esm/ApiClient/WebSocketClient/index.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/messages.js +2 -0
- package/dist-esm/ApiClient/WebSocketClient/messages.js.map +1 -0
- package/dist-esm/ApiClient/WebSocketClient/types.js +2 -0
- package/dist-esm/ApiClient/WebSocketClient/types.js.map +1 -0
- package/dist-esm/ApiClient/events.js +2 -0
- package/dist-esm/ApiClient/events.js.map +1 -0
- package/dist-esm/ApiClient/index.js +120 -0
- package/dist-esm/ApiClient/index.js.map +1 -0
- package/dist-esm/ApiGroup.js +10 -0
- package/dist-esm/ApiGroup.js.map +1 -0
- package/dist-esm/Chat/ChatStream.js +181 -0
- package/dist-esm/Chat/ChatStream.js.map +1 -0
- package/dist-esm/Chat/ChatTools.js +562 -0
- package/dist-esm/Chat/ChatTools.js.map +1 -0
- package/dist-esm/Chat/hostedToolValidation.generated.js +301 -0
- package/dist-esm/Chat/hostedToolValidation.generated.js.map +1 -0
- package/dist-esm/Chat/index.js +598 -0
- package/dist-esm/Chat/index.js.map +1 -0
- package/dist-esm/Chat/modelRouting.js +326 -0
- package/dist-esm/Chat/modelRouting.js.map +1 -0
- package/dist-esm/Chat/sogniHostedTools.generated.json +1531 -0
- package/dist-esm/Chat/tools.js +149 -0
- package/dist-esm/Chat/tools.js.map +1 -0
- package/dist-esm/Chat/types.js +2 -0
- package/dist-esm/Chat/types.js.map +1 -0
- package/dist-esm/CreativeWorkflows/index.js +256 -0
- package/dist-esm/CreativeWorkflows/index.js.map +1 -0
- package/dist-esm/CreativeWorkflows/types.js +2 -0
- package/dist-esm/CreativeWorkflows/types.js.map +1 -0
- package/dist-esm/Projects/Job.js +391 -0
- package/dist-esm/Projects/Job.js.map +1 -0
- package/dist-esm/Projects/Project.js +295 -0
- package/dist-esm/Projects/Project.js.map +1 -0
- package/dist-esm/Projects/createJobRequestMessage.js +528 -0
- package/dist-esm/Projects/createJobRequestMessage.js.map +1 -0
- package/dist-esm/Projects/index.js +1309 -0
- package/dist-esm/Projects/index.js.map +1 -0
- package/dist-esm/Projects/types/ComfySamplerParams.js +2 -0
- package/dist-esm/Projects/types/ComfySamplerParams.js.map +1 -0
- package/dist-esm/Projects/types/ControlNetParams.js +2 -0
- package/dist-esm/Projects/types/ControlNetParams.js.map +1 -0
- package/dist-esm/Projects/types/EstimationResponse.js +2 -0
- package/dist-esm/Projects/types/EstimationResponse.js.map +1 -0
- package/dist-esm/Projects/types/ModelOptions.js +89 -0
- package/dist-esm/Projects/types/ModelOptions.js.map +1 -0
- package/dist-esm/Projects/types/ModelTiersRaw.js +13 -0
- package/dist-esm/Projects/types/ModelTiersRaw.js.map +1 -0
- package/dist-esm/Projects/types/RawProject.js +2 -0
- package/dist-esm/Projects/types/RawProject.js.map +1 -0
- package/dist-esm/Projects/types/events.js +2 -0
- package/dist-esm/Projects/types/events.js.map +1 -0
- package/dist-esm/Projects/types/index.js +10 -0
- package/dist-esm/Projects/types/index.js.map +1 -0
- package/dist-esm/Projects/utils/index.js +229 -0
- package/dist-esm/Projects/utils/index.js.map +1 -0
- package/dist-esm/Projects/utils/samplers.js +36 -0
- package/dist-esm/Projects/utils/samplers.js.map +1 -0
- package/dist-esm/Projects/utils/scheduler.js +27 -0
- package/dist-esm/Projects/utils/scheduler.js.map +1 -0
- package/dist-esm/Stats/index.js +20 -0
- package/dist-esm/Stats/index.js.map +1 -0
- package/dist-esm/Stats/types.js +2 -0
- package/dist-esm/Stats/types.js.map +1 -0
- package/dist-esm/events.js +2 -0
- package/dist-esm/events.js.map +1 -0
- package/dist-esm/index.js +144 -0
- package/dist-esm/index.js.map +1 -0
- package/dist-esm/lib/AuthManager/ApiKeyAuthManager.js +58 -0
- package/dist-esm/lib/AuthManager/ApiKeyAuthManager.js.map +1 -0
- package/dist-esm/lib/AuthManager/AuthManagerBase.js +9 -0
- package/dist-esm/lib/AuthManager/AuthManagerBase.js.map +1 -0
- package/dist-esm/lib/AuthManager/CookieAuthManager.js +48 -0
- package/dist-esm/lib/AuthManager/CookieAuthManager.js.map +1 -0
- package/dist-esm/lib/AuthManager/TokenAuthManager.js +186 -0
- package/dist-esm/lib/AuthManager/TokenAuthManager.js.map +1 -0
- package/dist-esm/lib/AuthManager/index.js +5 -0
- package/dist-esm/lib/AuthManager/index.js.map +1 -0
- package/dist-esm/lib/Cache.js +32 -0
- package/dist-esm/lib/Cache.js.map +1 -0
- package/dist-esm/lib/DataEntity.js +30 -0
- package/dist-esm/lib/DataEntity.js.map +1 -0
- package/dist-esm/lib/DefaultLogger.js +32 -0
- package/dist-esm/lib/DefaultLogger.js.map +1 -0
- package/dist-esm/lib/EIP712Helper.js +37 -0
- package/dist-esm/lib/EIP712Helper.js.map +1 -0
- package/dist-esm/lib/RestClient.js +90 -0
- package/dist-esm/lib/RestClient.js.map +1 -0
- package/dist-esm/lib/TypedEventEmitter.js +68 -0
- package/dist-esm/lib/TypedEventEmitter.js.map +1 -0
- package/dist-esm/lib/base64.js +18 -0
- package/dist-esm/lib/base64.js.map +1 -0
- package/dist-esm/lib/getUUID.js +7 -0
- package/dist-esm/lib/getUUID.js.map +1 -0
- package/dist-esm/lib/isNodejs.js +3 -0
- package/dist-esm/lib/isNodejs.js.map +1 -0
- package/dist-esm/lib/mediaValidation.js +277 -0
- package/dist-esm/lib/mediaValidation.js.map +1 -0
- package/dist-esm/lib/utils/index.js +30 -0
- package/dist-esm/lib/utils/index.js.map +1 -0
- package/dist-esm/lib/validation.js +138 -0
- package/dist-esm/lib/validation.js.map +1 -0
- package/dist-esm/package.json +3 -0
- package/dist-esm/types/ErrorData.js +2 -0
- package/dist-esm/types/ErrorData.js.map +1 -0
- package/dist-esm/types/json.js +2 -0
- package/dist-esm/types/json.js.map +1 -0
- package/dist-esm/types/token.js +2 -0
- package/dist-esm/types/token.js.map +1 -0
- package/dist-esm/version.js +3 -0
- package/dist-esm/version.js.map +1 -0
- package/llms-full.txt +11 -20
- package/llms.txt +9 -18
- package/package.json +21 -5
- package/src/Chat/ChatTools.ts +36 -16
- package/src/Chat/hostedToolValidation.generated.ts +453 -0
- package/src/Chat/index.ts +198 -3
- package/src/Chat/modelRouting.ts +26 -150
- package/src/Chat/sogniHostedTools.generated.json +1285 -283
- package/src/Chat/tools.ts +106 -41
- package/src/Chat/types.ts +131 -3
- package/src/CreativeWorkflows/index.ts +22 -41
- package/src/CreativeWorkflows/types.ts +69 -42
- package/src/index.ts +33 -12
- package/src/lib/Cache.ts +8 -1
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import ApiGroup from '../ApiGroup';
|
|
11
|
+
import { parseEther, pbkdf2, toUtf8Bytes, Wallet } from 'ethers';
|
|
12
|
+
import { ApiError } from '../ApiClient';
|
|
13
|
+
import CurrentAccount from './CurrentAccount';
|
|
14
|
+
import { delay } from '../lib/utils';
|
|
15
|
+
import { ApiKeyAuthManager, CookieAuthManager, TokenAuthManager } from '../lib/AuthManager';
|
|
16
|
+
const MAX_DEPOSIT_ATTEMPTS = 4;
|
|
17
|
+
var ErrorCode;
|
|
18
|
+
(function (ErrorCode) {
|
|
19
|
+
ErrorCode[ErrorCode["INSUFFICIENT_BALANCE"] = 123] = "INSUFFICIENT_BALANCE";
|
|
20
|
+
ErrorCode[ErrorCode["INSUFFICIENT_ALLOWANCE"] = 149] = "INSUFFICIENT_ALLOWANCE";
|
|
21
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
22
|
+
/**
|
|
23
|
+
* Account API methods that let you interact with the user's account.
|
|
24
|
+
* Can be accessed via `sogni.account`. Look for more samples below.
|
|
25
|
+
*
|
|
26
|
+
* @example Retrieve the current account balance
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const balance = await sogni.account.refreshBalance();
|
|
29
|
+
* console.log(balance);
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
class AccountApi extends ApiGroup {
|
|
34
|
+
constructor(config) {
|
|
35
|
+
super(config);
|
|
36
|
+
this.currentAccount = new CurrentAccount();
|
|
37
|
+
this.currentAccount._update({
|
|
38
|
+
networkStatus: this.client.socket.isConnected ? 'connected' : 'disconnected',
|
|
39
|
+
network: this.client.socket.supernetType
|
|
40
|
+
});
|
|
41
|
+
this.client.socket.on('balanceUpdate', this.handleBalanceUpdate.bind(this));
|
|
42
|
+
this.client.socket.on('changeNetwork', this.handleChangeNetwork.bind(this));
|
|
43
|
+
this.client.socket.on('authenticated', this.handleSocketAuthenticated.bind(this));
|
|
44
|
+
this.client.on('connected', this.handleServerConnected.bind(this));
|
|
45
|
+
this.client.on('disconnected', this.handleServerDisconnected.bind(this));
|
|
46
|
+
this.client.auth.on('updated', this.handleAuthUpdated.bind(this));
|
|
47
|
+
}
|
|
48
|
+
handleBalanceUpdate(data) {
|
|
49
|
+
this.currentAccount._update({ balance: data });
|
|
50
|
+
}
|
|
51
|
+
handleChangeNetwork({ network }) {
|
|
52
|
+
this.currentAccount._update({ network, networkStatus: 'connected' });
|
|
53
|
+
}
|
|
54
|
+
handleServerConnected({ network }) {
|
|
55
|
+
this.currentAccount._update({
|
|
56
|
+
networkStatus: 'connected',
|
|
57
|
+
network
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
handleServerDisconnected() {
|
|
61
|
+
this.currentAccount._update({
|
|
62
|
+
networkStatus: 'disconnected',
|
|
63
|
+
network: null
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
handleSocketAuthenticated(data) {
|
|
67
|
+
// Populate account early from socket authenticated event (me() will overwrite with full data)
|
|
68
|
+
if (this.client.auth instanceof ApiKeyAuthManager) {
|
|
69
|
+
this.currentAccount._update({
|
|
70
|
+
username: data.username,
|
|
71
|
+
walletAddress: data.address
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
handleAuthUpdated(isAuthenticated) {
|
|
76
|
+
if (!isAuthenticated) {
|
|
77
|
+
this.currentAccount._clear();
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
this.me();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get the nonce for the given wallet address.
|
|
85
|
+
* @param walletAddress
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
getNonce(walletAddress) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const res = yield this.client.rest.post('/v1/account/nonce', {
|
|
91
|
+
walletAddress
|
|
92
|
+
});
|
|
93
|
+
return res.data.nonce;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Create Ethers.js Wallet instance from username and password.
|
|
98
|
+
* This method is used internally to create a wallet for the user.
|
|
99
|
+
* You can use this method to create a wallet if you need to sign transactions.
|
|
100
|
+
*
|
|
101
|
+
* @example Create a wallet from username and password
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const wallet = sogni.account.getWallet('username', 'password');
|
|
104
|
+
* console.log(wallet.address);
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @param username - Sogni account username
|
|
108
|
+
* @param password - Sogni account password
|
|
109
|
+
*/
|
|
110
|
+
getWallet(username, password) {
|
|
111
|
+
const pwd = toUtf8Bytes(username.toLowerCase() + password);
|
|
112
|
+
const salt = toUtf8Bytes('sogni-salt-value');
|
|
113
|
+
const pkey = pbkdf2(pwd, salt, 10000, 32, 'sha256');
|
|
114
|
+
return new Wallet(pkey);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Create a new account with the given username, email, and password.
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
create(_a) {
|
|
121
|
+
return __awaiter(this, arguments, void 0, function* ({ username, email, password, subscribe, turnstileToken, referralCode, appSource }, rememberMe = false) {
|
|
122
|
+
const wallet = this.getWallet(username, password);
|
|
123
|
+
const nonce = yield this.getNonce(wallet.address);
|
|
124
|
+
const payload = {
|
|
125
|
+
appid: this.client.appId,
|
|
126
|
+
username,
|
|
127
|
+
email,
|
|
128
|
+
subscribe: subscribe ? 1 : 0,
|
|
129
|
+
walletAddress: wallet.address,
|
|
130
|
+
turnstileToken
|
|
131
|
+
};
|
|
132
|
+
const resolvedAppSource = (appSource === null || appSource === void 0 ? void 0 : appSource.trim()) || this.client.appSource;
|
|
133
|
+
const signature = yield this.eip712.signTypedData(wallet, 'signup', Object.assign(Object.assign({}, payload), { nonce }));
|
|
134
|
+
const res = yield this.client.rest.post('/v1/account/create', Object.assign(Object.assign(Object.assign({}, payload), (resolvedAppSource ? { appSource: resolvedAppSource } : {})), { referralCode,
|
|
135
|
+
signature,
|
|
136
|
+
rememberMe }));
|
|
137
|
+
const auth = this.client.auth;
|
|
138
|
+
if (auth instanceof TokenAuthManager) {
|
|
139
|
+
yield auth.authenticate({ refreshToken: res.data.refreshToken, token: res.data.token });
|
|
140
|
+
}
|
|
141
|
+
else if (auth instanceof CookieAuthManager) {
|
|
142
|
+
yield auth.authenticate();
|
|
143
|
+
}
|
|
144
|
+
return res.data;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Login with username and password. WebSocket connection is established after successful login.
|
|
149
|
+
*
|
|
150
|
+
* @example Login with username and password
|
|
151
|
+
* ```typescript
|
|
152
|
+
* await sogni.account.login('username', 'password');
|
|
153
|
+
* console.log('Logged in');
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @param username
|
|
157
|
+
* @param password
|
|
158
|
+
* @param rememberMe - Whether to establish a long-lived session. Default is false. Only
|
|
159
|
+
* applicable for cookie-based authentication.
|
|
160
|
+
* @param appSource - Optional client app/source label for login attribution. Defaults to the
|
|
161
|
+
* SogniClient connection appSource when configured.
|
|
162
|
+
*/
|
|
163
|
+
login(username_1, password_1) {
|
|
164
|
+
return __awaiter(this, arguments, void 0, function* (username, password, rememberMe = false, appSource) {
|
|
165
|
+
const wallet = this.getWallet(username, password);
|
|
166
|
+
const nonce = yield this.getNonce(wallet.address);
|
|
167
|
+
const signature = yield this.eip712.signTypedData(wallet, 'authentication', {
|
|
168
|
+
walletAddress: wallet.address,
|
|
169
|
+
nonce
|
|
170
|
+
});
|
|
171
|
+
const resolvedAppSource = (appSource === null || appSource === void 0 ? void 0 : appSource.trim()) || this.client.appSource;
|
|
172
|
+
const res = yield this.client.rest.post('/v1/account/login', Object.assign(Object.assign({ walletAddress: wallet.address, signature }, (resolvedAppSource ? { appSource: resolvedAppSource } : {})), { rememberMe }));
|
|
173
|
+
const auth = this.client.auth;
|
|
174
|
+
if (auth instanceof TokenAuthManager) {
|
|
175
|
+
yield auth.authenticate({ refreshToken: res.data.refreshToken, token: res.data.token });
|
|
176
|
+
}
|
|
177
|
+
else if (auth instanceof CookieAuthManager) {
|
|
178
|
+
yield auth.authenticate();
|
|
179
|
+
}
|
|
180
|
+
return res.data;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Logout the user and close the WebSocket connection.
|
|
185
|
+
*
|
|
186
|
+
* @example Logout the user
|
|
187
|
+
* ```typescript
|
|
188
|
+
* await sogni.account.logout();
|
|
189
|
+
* console.log('Logged out');
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
logout() {
|
|
193
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
194
|
+
try {
|
|
195
|
+
yield this.client.rest.post('/v1/account/logout');
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
if (e instanceof ApiError && e.status === 401) {
|
|
199
|
+
this.client.logger.warn('Failed to logout, probably already logged out');
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
throw e;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
this.client.auth.clear();
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Refresh the balance of the current account.
|
|
210
|
+
*
|
|
211
|
+
* Usually, you don't need to call this method manually. Balance is updated automatically
|
|
212
|
+
* through WebSocket events. But you can call this method to force a balance refresh. Note that
|
|
213
|
+
* will also trigger updated event on the current account.
|
|
214
|
+
*
|
|
215
|
+
* @example Refresh user account balance
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const balance = await sogni.account.refreshBalance();
|
|
218
|
+
* console.log(balance);
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
refreshBalance() {
|
|
222
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
223
|
+
const balance = yield this.accountBalance();
|
|
224
|
+
this.currentAccount._update({ balance: balance });
|
|
225
|
+
return balance;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Get the account balance of the current account.
|
|
230
|
+
* This method returns the account balance of the current user, including settled, credit, debit, and unclaimed earnings amounts.
|
|
231
|
+
*
|
|
232
|
+
* @example Get the account balance of the current user
|
|
233
|
+
* ```typescript
|
|
234
|
+
* const balance = await sogni.account.accountBalance();
|
|
235
|
+
* console.log(balance);
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
accountBalance() {
|
|
239
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
240
|
+
const res = yield this.client.rest.get('/v4/account/balance');
|
|
241
|
+
return res.data;
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Get the balance of the wallet address.
|
|
246
|
+
*
|
|
247
|
+
* This method is used to get the balance of the wallet address. It returns $SOGNI and ETH balance.
|
|
248
|
+
*
|
|
249
|
+
* @example Get the balance of the wallet address
|
|
250
|
+
* ```typescript
|
|
251
|
+
* const address = sogni.account.currentAccount.walletAddress;
|
|
252
|
+
* const balance = await sogni.account.walletBalance(address);
|
|
253
|
+
* console.log(balance);
|
|
254
|
+
* // { token: '100.000000', ether: '0.000000' }
|
|
255
|
+
* ```
|
|
256
|
+
*
|
|
257
|
+
* @param walletAddress
|
|
258
|
+
* @param provider - blockchain provider, 'base' or 'etherlink' defaults to 'base'
|
|
259
|
+
*/
|
|
260
|
+
walletBalance(walletAddress_1) {
|
|
261
|
+
return __awaiter(this, arguments, void 0, function* (walletAddress, provider = 'base') {
|
|
262
|
+
const res = yield this.client.rest.get('/v2/wallet/balance', {
|
|
263
|
+
walletAddress,
|
|
264
|
+
provider
|
|
265
|
+
});
|
|
266
|
+
return res.data;
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
me() {
|
|
270
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
271
|
+
const res = yield this.client.rest.get('/v1/account/me');
|
|
272
|
+
this.currentAccount._update({
|
|
273
|
+
username: res.data.username,
|
|
274
|
+
email: res.data.currentEmail,
|
|
275
|
+
walletAddress: res.data.walletAddress
|
|
276
|
+
});
|
|
277
|
+
return res.data;
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Validate the username before signup
|
|
282
|
+
* @internal
|
|
283
|
+
* @param username
|
|
284
|
+
*/
|
|
285
|
+
validateUsername(username) {
|
|
286
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
287
|
+
try {
|
|
288
|
+
return yield this.client.rest.post('/v1/account/username/validate', {
|
|
289
|
+
username
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
catch (e) {
|
|
293
|
+
if (e instanceof ApiError) {
|
|
294
|
+
// Username is already taken
|
|
295
|
+
if (e.payload.errorCode === 108) {
|
|
296
|
+
return e.payload;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
throw e;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Switch between fast and relaxed networks.
|
|
305
|
+
* This will change default network used to process projects. After switching, client will receive
|
|
306
|
+
* list of AI models available for on selected network.
|
|
307
|
+
*
|
|
308
|
+
* @example Switch to the fast network
|
|
309
|
+
* ```typescript
|
|
310
|
+
* await sogni.account.switchNetwork('fast');
|
|
311
|
+
* console.log('Switched to the fast network, now lets wait until we get list of models');
|
|
312
|
+
* await sogni.projects.waitForModels();
|
|
313
|
+
* ```
|
|
314
|
+
* @param network - Network type to switch to
|
|
315
|
+
*/
|
|
316
|
+
switchNetwork(network) {
|
|
317
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
318
|
+
this.currentAccount._update({
|
|
319
|
+
networkStatus: 'switching',
|
|
320
|
+
network: null
|
|
321
|
+
});
|
|
322
|
+
const newNetwork = yield this.client.socket.switchNetwork(network);
|
|
323
|
+
this.currentAccount._update({
|
|
324
|
+
networkStatus: 'connected',
|
|
325
|
+
network: newNetwork
|
|
326
|
+
});
|
|
327
|
+
return newNetwork;
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Get the transaction history of the current account.
|
|
332
|
+
*
|
|
333
|
+
* @example Get the transaction history
|
|
334
|
+
* ```typescript
|
|
335
|
+
* const { entries, next } = await sogni.account.transactionHistory({
|
|
336
|
+
* status: 'completed',
|
|
337
|
+
* limit: 10,
|
|
338
|
+
* address: sogni.account.currentAccount.walletAddress
|
|
339
|
+
* });
|
|
340
|
+
* ```
|
|
341
|
+
*
|
|
342
|
+
* @param params - Transaction history query parameters
|
|
343
|
+
* @returns Transaction history entries and next query parameters
|
|
344
|
+
*/
|
|
345
|
+
transactionHistory(params) {
|
|
346
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
347
|
+
const query = {
|
|
348
|
+
status: params.status,
|
|
349
|
+
address: params.address,
|
|
350
|
+
limit: params.limit.toString()
|
|
351
|
+
};
|
|
352
|
+
if (params.offset) {
|
|
353
|
+
query.offset = params.offset.toString();
|
|
354
|
+
}
|
|
355
|
+
if (params.provider) {
|
|
356
|
+
query.provider = params.provider;
|
|
357
|
+
}
|
|
358
|
+
const res = yield this.client.rest.get('/v1/transactions/list', query);
|
|
359
|
+
return {
|
|
360
|
+
entries: res.data.transactions.map((tx) => ({
|
|
361
|
+
id: tx.id,
|
|
362
|
+
address: tx.address,
|
|
363
|
+
createTime: new Date(tx.createTime),
|
|
364
|
+
updateTime: new Date(tx.updateTime),
|
|
365
|
+
status: tx.status,
|
|
366
|
+
role: tx.role,
|
|
367
|
+
amount: tx.amount,
|
|
368
|
+
tokenType: tx.tokenType,
|
|
369
|
+
description: tx.description,
|
|
370
|
+
source: tx.source,
|
|
371
|
+
endTime: new Date(tx.endTime),
|
|
372
|
+
type: tx.type
|
|
373
|
+
})),
|
|
374
|
+
next: Object.assign(Object.assign({}, params), { offset: res.data.next })
|
|
375
|
+
};
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Get the rewards of the current account.
|
|
380
|
+
* @internal
|
|
381
|
+
*/
|
|
382
|
+
rewards() {
|
|
383
|
+
return __awaiter(this, arguments, void 0, function* (query = {}) {
|
|
384
|
+
const r = yield this.client.rest.get('/v4/account/rewards', query);
|
|
385
|
+
return r.data.rewards.map((raw) => {
|
|
386
|
+
var _a;
|
|
387
|
+
return ({
|
|
388
|
+
id: raw.id,
|
|
389
|
+
type: raw.type,
|
|
390
|
+
title: raw.title,
|
|
391
|
+
description: raw.description,
|
|
392
|
+
amount: raw.amount,
|
|
393
|
+
tokenType: raw.tokenType,
|
|
394
|
+
claimed: !!raw.claimed,
|
|
395
|
+
canClaim: !!raw.canClaim,
|
|
396
|
+
cantClaimReason: (_a = raw.cantClaimReason) !== null && _a !== void 0 ? _a : null,
|
|
397
|
+
lastClaim: new Date(raw.lastClaimTimestamp * 1000),
|
|
398
|
+
provider: query.provider || 'base',
|
|
399
|
+
nextClaim: raw.lastClaimTimestamp && raw.claimResetFrequencySec > -1
|
|
400
|
+
? new Date(raw.lastClaimTimestamp * 1000 + raw.claimResetFrequencySec * 1000)
|
|
401
|
+
: null
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Claim rewards by reward IDs.
|
|
408
|
+
* @internal
|
|
409
|
+
* @param rewardIds
|
|
410
|
+
* @param options - Options for claiming rewards
|
|
411
|
+
* @param options.turnstileToken - Turnstile token for anti-bot protection
|
|
412
|
+
* @param options.provider - Provider name for the rewards
|
|
413
|
+
*/
|
|
414
|
+
claimRewards(rewardIds_1) {
|
|
415
|
+
return __awaiter(this, arguments, void 0, function* (rewardIds, { turnstileToken, provider } = {}) {
|
|
416
|
+
const payload = {
|
|
417
|
+
claims: rewardIds,
|
|
418
|
+
provider: provider || 'base'
|
|
419
|
+
};
|
|
420
|
+
if (turnstileToken) {
|
|
421
|
+
payload.turnstileToken = turnstileToken;
|
|
422
|
+
}
|
|
423
|
+
yield this.client.rest.post('/v3/account/reward/claim', payload);
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Withdraw funds from the current account to wallet.
|
|
428
|
+
* @example withdraw to current wallet address
|
|
429
|
+
* ```typescript
|
|
430
|
+
* await sogni.account.withdraw('your-account-password', 100, 'etherlink');
|
|
431
|
+
* ```
|
|
432
|
+
*
|
|
433
|
+
* @param password - account password
|
|
434
|
+
* @param amount - amount of tokens to withdraw from account to wallet
|
|
435
|
+
* @param provider - blockchain provider, 'base' or 'etherlink' defaults to 'base'
|
|
436
|
+
*/
|
|
437
|
+
withdraw(password_1, amount_1) {
|
|
438
|
+
return __awaiter(this, arguments, void 0, function* (password, amount, provider = 'base') {
|
|
439
|
+
const wallet = this.getWallet(this.currentAccount.username, password);
|
|
440
|
+
const walletAddress = wallet.address;
|
|
441
|
+
//const nonce = await this.getNonce(walletAddress);
|
|
442
|
+
const payload = {
|
|
443
|
+
walletAddress,
|
|
444
|
+
amount: parseEther(amount.toString()).toString(),
|
|
445
|
+
provider
|
|
446
|
+
};
|
|
447
|
+
if (walletAddress !== this.currentAccount.walletAddress) {
|
|
448
|
+
throw new ApiError(400, {
|
|
449
|
+
status: 'error',
|
|
450
|
+
message: 'Incorrect password',
|
|
451
|
+
errorCode: 0
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
const permitR = yield this.client.rest.post('/v1/account/token/withdraw/permit', payload);
|
|
455
|
+
const { domain, types, message } = permitR.data;
|
|
456
|
+
const signature = yield wallet.signTypedData(domain, types, message);
|
|
457
|
+
yield this.client.rest.post('/v2/account/token/withdraw', Object.assign(Object.assign({}, payload), { signature }));
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Deposit tokens from wallet to account
|
|
462
|
+
* @example withdraw to current wallet address
|
|
463
|
+
* ```typescript
|
|
464
|
+
* await sogni.account.deposit('your-account-password', 100, 'base');
|
|
465
|
+
* ```
|
|
466
|
+
*
|
|
467
|
+
* @param password - account password
|
|
468
|
+
* @param amount - amount to transfer
|
|
469
|
+
* @param provider - blockchain provider, 'base' or 'etherlink' defaults to 'base'
|
|
470
|
+
*/
|
|
471
|
+
deposit(password_1, amount_1) {
|
|
472
|
+
return __awaiter(this, arguments, void 0, function* (password, amount, provider = 'base') {
|
|
473
|
+
return this._deposit(password, amount, provider, 1);
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
_deposit(password_1, amount_1) {
|
|
477
|
+
return __awaiter(this, arguments, void 0, function* (password, amount, provider = 'base', attemptCount = 1) {
|
|
478
|
+
const wallet = this.getWallet(this.currentAccount.username, password);
|
|
479
|
+
if (wallet.address !== this.currentAccount.walletAddress) {
|
|
480
|
+
throw new ApiError(400, {
|
|
481
|
+
status: 'error',
|
|
482
|
+
message: 'Incorrect password',
|
|
483
|
+
errorCode: 0
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
try {
|
|
487
|
+
yield this.client.rest.post('/v3/account/token/deposit', {
|
|
488
|
+
walletAddress: wallet.address,
|
|
489
|
+
amount: parseEther(amount.toString()).toString(),
|
|
490
|
+
provider: provider
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
catch (error) {
|
|
494
|
+
if (error instanceof ApiError) {
|
|
495
|
+
if (error.payload.errorCode === ErrorCode.INSUFFICIENT_ALLOWANCE) {
|
|
496
|
+
// If this is the first attempt, we need to approve the token usage,
|
|
497
|
+
// otherwise we can retry the deposit directly.
|
|
498
|
+
if (attemptCount === 1) {
|
|
499
|
+
yield this.approveTokenUsage(password, 'account', provider);
|
|
500
|
+
}
|
|
501
|
+
if (attemptCount >= MAX_DEPOSIT_ATTEMPTS) {
|
|
502
|
+
throw error;
|
|
503
|
+
}
|
|
504
|
+
yield delay(10000); // Wait for the approval transaction to be processed
|
|
505
|
+
yield this._deposit(password, amount, provider, attemptCount + 1);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
throw error;
|
|
509
|
+
}
|
|
510
|
+
throw error;
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Approve SOGNI token usage for the specified spender.
|
|
516
|
+
* @internal
|
|
517
|
+
*
|
|
518
|
+
* @param password - user account password
|
|
519
|
+
* @param spender - Spender type, either 'account' for deposit or 'staker' for staking contract
|
|
520
|
+
* @param provider - Provider name, defaults to 'base', can be 'base', 'etherlink', etc.
|
|
521
|
+
*/
|
|
522
|
+
approveTokenUsage(password_1, spender_1) {
|
|
523
|
+
return __awaiter(this, arguments, void 0, function* (password, spender, provider = 'base') {
|
|
524
|
+
const wallet = this.getWallet(this.currentAccount.username, password);
|
|
525
|
+
const permitR = yield this.client.rest.post('/v1/contract/token/approve/permit', {
|
|
526
|
+
walletAddress: wallet.address,
|
|
527
|
+
spender: spender,
|
|
528
|
+
provider: provider
|
|
529
|
+
});
|
|
530
|
+
const { domain, types, message } = permitR.data;
|
|
531
|
+
const signature = yield wallet.signTypedData(domain, types, message);
|
|
532
|
+
yield this.client.rest.post('/v1/contract/token/approve', {
|
|
533
|
+
walletAddress: wallet.address,
|
|
534
|
+
spender: spender,
|
|
535
|
+
provider: provider,
|
|
536
|
+
deadline: message.deadline,
|
|
537
|
+
approveSignature: signature
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
export default AccountApi;
|
|
543
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Account/index.ts"],"names":[],"mappings":";;;;;;;;;AAgBA,OAAO,QAAuB,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAe,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE5F,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,IAAK,SAGJ;AAHD,WAAK,SAAS;IACZ,2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