@silkysquad/silk 1.0.1 → 1.0.2
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/cli.d.ts +2 -0
- package/dist/cli.js +163 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.js +36 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/account.d.ts +11 -0
- package/dist/commands/account.js +156 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/balance.d.ts +3 -0
- package/dist/commands/balance.js +12 -0
- package/dist/commands/balance.js.map +1 -0
- package/dist/commands/cancel.d.ts +3 -0
- package/dist/commands/cancel.js +28 -0
- package/dist/commands/cancel.js.map +1 -0
- package/dist/commands/chat.d.ts +1 -0
- package/dist/commands/chat.js +12 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/claim.d.ts +3 -0
- package/dist/commands/claim.js +28 -0
- package/dist/commands/claim.js.map +1 -0
- package/dist/commands/config.d.ts +6 -0
- package/dist/commands/config.js +40 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/contacts.d.ts +4 -0
- package/dist/commands/contacts.js +23 -0
- package/dist/commands/contacts.js.map +1 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +37 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/pay.d.ts +4 -0
- package/dist/commands/pay.js +35 -0
- package/dist/commands/pay.js.map +1 -0
- package/dist/commands/payments.d.ts +4 -0
- package/dist/commands/payments.js +23 -0
- package/dist/commands/payments.js.map +1 -0
- package/dist/commands/wallet.d.ts +7 -0
- package/dist/commands/wallet.js +61 -0
- package/dist/commands/wallet.js.map +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.js +63 -0
- package/dist/config.js.map +1 -0
- package/dist/contacts.d.ts +15 -0
- package/dist/contacts.js +74 -0
- package/dist/contacts.js.map +1 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +87 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +4 -0
- package/dist/output.js +42 -0
- package/dist/output.js.map +1 -0
- package/dist/transfers.d.ts +32 -0
- package/dist/transfers.js +12 -0
- package/dist/transfers.js.map +1 -0
- package/dist/validate.d.ts +8 -0
- package/dist/validate.js +69 -0
- package/dist/validate.js.map +1 -0
- package/package.json +26 -4
- package/CHANGELOG.md +0 -43
- package/SKILL.md +0 -698
- package/index.js +0 -1
- package/src/cli.ts +0 -175
- package/src/client.ts +0 -49
- package/src/commands/account.ts +0 -210
- package/src/commands/balance.ts +0 -14
- package/src/commands/cancel.ts +0 -34
- package/src/commands/chat.ts +0 -14
- package/src/commands/claim.ts +0 -34
- package/src/commands/config.ts +0 -46
- package/src/commands/contacts.ts +0 -26
- package/src/commands/init.ts +0 -44
- package/src/commands/pay.ts +0 -41
- package/src/commands/payments.ts +0 -29
- package/src/commands/wallet.ts +0 -67
- package/src/config.ts +0 -101
- package/src/contacts.ts +0 -94
- package/src/errors.ts +0 -95
- package/src/output.ts +0 -42
- package/src/transfers.ts +0 -49
- package/src/validate.ts +0 -80
- package/tsconfig.json +0 -19
- /package/{src/index.ts → dist/index.d.ts} +0 -0
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { walletCreate, walletList, walletFund } from './commands/wallet.js';
|
|
4
|
+
import { balance } from './commands/balance.js';
|
|
5
|
+
import { pay } from './commands/pay.js';
|
|
6
|
+
import { claim } from './commands/claim.js';
|
|
7
|
+
import { cancel } from './commands/cancel.js';
|
|
8
|
+
import { paymentsList, paymentsGet } from './commands/payments.js';
|
|
9
|
+
import { configSetApiUrl, configGetApiUrl, configResetApiUrl, configSetCluster, configGetCluster, configResetCluster } from './commands/config.js';
|
|
10
|
+
import { accountSync, accountStatus, accountSend } from './commands/account.js';
|
|
11
|
+
import { contactsAdd, contactsRemove, contactsList, contactsGet } from './commands/contacts.js';
|
|
12
|
+
import { chat } from './commands/chat.js';
|
|
13
|
+
import { init } from './commands/init.js';
|
|
14
|
+
import { wrapCommand } from './output.js';
|
|
15
|
+
const program = new Command();
|
|
16
|
+
program
|
|
17
|
+
.name('silk')
|
|
18
|
+
.description('Silkyway SDK — Agent payments on Solana')
|
|
19
|
+
.version('0.1.0')
|
|
20
|
+
.option('--human', 'Human-readable output');
|
|
21
|
+
// init
|
|
22
|
+
program
|
|
23
|
+
.command('init')
|
|
24
|
+
.description('Initialize Silk CLI (create default wallet and agent ID)')
|
|
25
|
+
.action(wrapCommand(init));
|
|
26
|
+
// wallet commands
|
|
27
|
+
const wallet = program.command('wallet').description('Manage wallets');
|
|
28
|
+
wallet
|
|
29
|
+
.command('create')
|
|
30
|
+
.argument('[label]', 'wallet label', 'main')
|
|
31
|
+
.description('Create a new wallet')
|
|
32
|
+
.action(wrapCommand(walletCreate));
|
|
33
|
+
wallet
|
|
34
|
+
.command('list')
|
|
35
|
+
.description('List all wallets')
|
|
36
|
+
.action(wrapCommand(walletList));
|
|
37
|
+
wallet
|
|
38
|
+
.command('fund')
|
|
39
|
+
.option('--sol', 'Request SOL only')
|
|
40
|
+
.option('--usdc', 'Request USDC only')
|
|
41
|
+
.option('--wallet <label>', 'Wallet to fund')
|
|
42
|
+
.description('Fund wallet from devnet faucet (devnet only)')
|
|
43
|
+
.action(wrapCommand(walletFund));
|
|
44
|
+
// balance
|
|
45
|
+
program
|
|
46
|
+
.command('balance')
|
|
47
|
+
.option('--wallet <label>', 'Wallet to check')
|
|
48
|
+
.description('Check wallet balances')
|
|
49
|
+
.action(wrapCommand(balance));
|
|
50
|
+
// pay
|
|
51
|
+
program
|
|
52
|
+
.command('pay')
|
|
53
|
+
.argument('<recipient>', 'Recipient wallet address')
|
|
54
|
+
.argument('<amount>', 'Amount in USDC')
|
|
55
|
+
.option('--memo <text>', 'Payment memo')
|
|
56
|
+
.option('--wallet <label>', 'Sender wallet')
|
|
57
|
+
.description('Send a USDC payment')
|
|
58
|
+
.action(wrapCommand(pay));
|
|
59
|
+
// claim
|
|
60
|
+
program
|
|
61
|
+
.command('claim')
|
|
62
|
+
.argument('<transferPda>', 'Transfer PDA to claim')
|
|
63
|
+
.option('--wallet <label>', 'Wallet to claim with')
|
|
64
|
+
.description('Claim a received payment')
|
|
65
|
+
.action(wrapCommand(claim));
|
|
66
|
+
// cancel
|
|
67
|
+
program
|
|
68
|
+
.command('cancel')
|
|
69
|
+
.argument('<transferPda>', 'Transfer PDA to cancel')
|
|
70
|
+
.option('--wallet <label>', 'Wallet to cancel with')
|
|
71
|
+
.description('Cancel a sent payment')
|
|
72
|
+
.action(wrapCommand(cancel));
|
|
73
|
+
// payments
|
|
74
|
+
const payments = program.command('payments').description('View payment history');
|
|
75
|
+
payments
|
|
76
|
+
.command('list')
|
|
77
|
+
.option('--wallet <label>', 'Wallet to query')
|
|
78
|
+
.description('List transfers')
|
|
79
|
+
.action(wrapCommand(paymentsList));
|
|
80
|
+
payments
|
|
81
|
+
.command('get')
|
|
82
|
+
.argument('<transferPda>', 'Transfer PDA')
|
|
83
|
+
.description('Get transfer details')
|
|
84
|
+
.action(wrapCommand(paymentsGet));
|
|
85
|
+
// config
|
|
86
|
+
const config = program.command('config').description('SDK configuration');
|
|
87
|
+
config
|
|
88
|
+
.command('set-api-url')
|
|
89
|
+
.argument('<url>', 'API base URL')
|
|
90
|
+
.description('Set the API base URL')
|
|
91
|
+
.action(wrapCommand(configSetApiUrl));
|
|
92
|
+
config
|
|
93
|
+
.command('get-api-url')
|
|
94
|
+
.description('Show the current API base URL')
|
|
95
|
+
.action(wrapCommand(configGetApiUrl));
|
|
96
|
+
config
|
|
97
|
+
.command('reset-api-url')
|
|
98
|
+
.description('Reset API URL to default')
|
|
99
|
+
.action(wrapCommand(configResetApiUrl));
|
|
100
|
+
config
|
|
101
|
+
.command('set-cluster')
|
|
102
|
+
.argument('<cluster>', 'Cluster: mainnet-beta or devnet')
|
|
103
|
+
.description('Set the Solana cluster')
|
|
104
|
+
.action(wrapCommand(configSetCluster));
|
|
105
|
+
config
|
|
106
|
+
.command('get-cluster')
|
|
107
|
+
.description('Show the current Solana cluster')
|
|
108
|
+
.action(wrapCommand(configGetCluster));
|
|
109
|
+
config
|
|
110
|
+
.command('reset-cluster')
|
|
111
|
+
.description('Reset cluster to default (mainnet-beta)')
|
|
112
|
+
.action(wrapCommand(configResetCluster));
|
|
113
|
+
// account commands
|
|
114
|
+
const account = program.command('account').description('Manage Silkysig account');
|
|
115
|
+
account
|
|
116
|
+
.command('sync')
|
|
117
|
+
.option('--wallet <label>', 'Wallet to sync')
|
|
118
|
+
.option('--account <pda>', 'Sync a specific account by PDA')
|
|
119
|
+
.description('Discover and sync your account')
|
|
120
|
+
.action(wrapCommand(accountSync));
|
|
121
|
+
account
|
|
122
|
+
.command('status')
|
|
123
|
+
.option('--wallet <label>', 'Wallet to check')
|
|
124
|
+
.description('Show account balance and policy')
|
|
125
|
+
.action(wrapCommand(accountStatus));
|
|
126
|
+
account
|
|
127
|
+
.command('send')
|
|
128
|
+
.argument('<recipient>', 'Recipient wallet address')
|
|
129
|
+
.argument('<amount>', 'Amount in USDC')
|
|
130
|
+
.option('--memo <text>', 'Payment memo')
|
|
131
|
+
.option('--wallet <label>', 'Sender wallet')
|
|
132
|
+
.description('Send from account (policy-enforced)')
|
|
133
|
+
.action(wrapCommand(accountSend));
|
|
134
|
+
// contacts commands
|
|
135
|
+
const contacts = program.command('contacts').description('Manage address book');
|
|
136
|
+
contacts
|
|
137
|
+
.command('add')
|
|
138
|
+
.argument('<name>', 'Contact name')
|
|
139
|
+
.argument('<address>', 'Solana wallet address')
|
|
140
|
+
.description('Add a contact')
|
|
141
|
+
.action(wrapCommand(contactsAdd));
|
|
142
|
+
contacts
|
|
143
|
+
.command('remove')
|
|
144
|
+
.argument('<name>', 'Contact name')
|
|
145
|
+
.description('Remove a contact')
|
|
146
|
+
.action(wrapCommand(contactsRemove));
|
|
147
|
+
contacts
|
|
148
|
+
.command('list')
|
|
149
|
+
.description('List all contacts')
|
|
150
|
+
.action(wrapCommand(contactsList));
|
|
151
|
+
contacts
|
|
152
|
+
.command('get')
|
|
153
|
+
.argument('<name>', 'Contact name')
|
|
154
|
+
.description('Get a contact address')
|
|
155
|
+
.action(wrapCommand(contactsGet));
|
|
156
|
+
// chat
|
|
157
|
+
program
|
|
158
|
+
.command('chat')
|
|
159
|
+
.argument('<message>', 'Message to send to support')
|
|
160
|
+
.description('Chat with Silkyway support agent')
|
|
161
|
+
.action(wrapCommand(chat));
|
|
162
|
+
program.parse();
|
|
163
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACnJ,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC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AC,CAAC,CAAC;AACvC,QAAQ;KACL,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,mBAAmB,CAAC;KAChC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;AACrC,QAAQ;KACL,OAAO,CAAC,KAAK,CAAC;KACd,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;KAClC,WAAW,CAAC,uBAAuB,CAAC;KACpC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;AAEpC,OAAO;AACP,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,QAAQ,CAAC,WAAW,EAAE,4BAA4B,CAAC;KACnD,WAAW,CAAC,kCAAkC,CAAC;KAC/C,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AAE7B,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/client.d.ts
ADDED
package/dist/client.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { SdkError, ANCHOR_ERROR_MAP } from './errors.js';
|
|
3
|
+
const DEFAULT_TIMEOUT = 30000;
|
|
4
|
+
export function createHttpClient(config = {}) {
|
|
5
|
+
const client = axios.create({
|
|
6
|
+
baseURL: config.baseUrl || 'http://localhost:3000',
|
|
7
|
+
timeout: config.timeout || DEFAULT_TIMEOUT,
|
|
8
|
+
headers: { 'Content-Type': 'application/json' },
|
|
9
|
+
});
|
|
10
|
+
client.interceptors.response.use((response) => response, (error) => {
|
|
11
|
+
if (error.response?.data?.error) {
|
|
12
|
+
const apiCode = error.response.data.error;
|
|
13
|
+
const apiMessage = error.response.data.message || 'Unknown API error';
|
|
14
|
+
if (apiCode === 'TX_FAILED') {
|
|
15
|
+
const hexMatch = apiMessage.match(/0x([0-9a-fA-F]+)/);
|
|
16
|
+
if (hexMatch) {
|
|
17
|
+
const errorCode = parseInt(hexMatch[1], 16);
|
|
18
|
+
const anchor = ANCHOR_ERROR_MAP[errorCode];
|
|
19
|
+
if (anchor) {
|
|
20
|
+
throw new SdkError(anchor.code, anchor.message);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
throw new SdkError(apiCode, apiMessage);
|
|
25
|
+
}
|
|
26
|
+
if (error.response?.data?.message) {
|
|
27
|
+
throw new SdkError('API_ERROR', error.response.data.message);
|
|
28
|
+
}
|
|
29
|
+
if (error.code === 'ECONNABORTED') {
|
|
30
|
+
throw new SdkError('TIMEOUT', 'Request timeout — is the Silkyway server running?');
|
|
31
|
+
}
|
|
32
|
+
throw new SdkError('NETWORK_ERROR', 'Network error — is the Silkyway server running?');
|
|
33
|
+
});
|
|
34
|
+
return client;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,eAAe,GAAG,KAAK,CAAC;AAO9B,MAAM,UAAU,gBAAgB,CAAC,SAAuB,EAAE;IACxD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC1B,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,uBAAuB;QAClD,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,eAAe;QAC1C,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;KAChD,CAAC,CAAC;IAEH,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAC9B,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EACtB,CAAC,KAAoE,EAAE,EAAE;QACvE,IAAI,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;YAC1C,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,IAAI,mBAAmB,CAAC;YAEtE,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;gBAC5B,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;gBACtD,IAAI,QAAQ,EAAE,CAAC;oBACb,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC5C,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;oBAC3C,IAAI,MAAM,EAAE,CAAC;wBACX,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;oBAClD,CAAC;gBACH,CAAC;YACH,CAAC;YAED,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;YAClC,MAAM,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAClC,MAAM,IAAI,QAAQ,CAAC,SAAS,EAAE,mDAAmD,CAAC,CAAC;QACrF,CAAC;QACD,MAAM,IAAI,QAAQ,CAAC,eAAe,EAAE,iDAAiD,CAAC,CAAC;IACzF,CAAC,CACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function accountSync(opts: {
|
|
2
|
+
wallet?: string;
|
|
3
|
+
account?: string;
|
|
4
|
+
}): Promise<void>;
|
|
5
|
+
export declare function accountStatus(opts: {
|
|
6
|
+
wallet?: string;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export declare function accountSend(recipient: string, amount: string, opts: {
|
|
9
|
+
memo?: string;
|
|
10
|
+
wallet?: string;
|
|
11
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { Keypair, Transaction } from '@solana/web3.js';
|
|
2
|
+
import bs58 from 'bs58';
|
|
3
|
+
import { loadConfig, saveConfig, getWallet, getApiUrl } from '../config.js';
|
|
4
|
+
import { createHttpClient } from '../client.js';
|
|
5
|
+
import { outputSuccess } from '../output.js';
|
|
6
|
+
import { SdkError, toSilkysigError } from '../errors.js';
|
|
7
|
+
import { validateAddress, validateAmount } from '../validate.js';
|
|
8
|
+
import { resolveRecipient } from '../contacts.js';
|
|
9
|
+
export async function accountSync(opts) {
|
|
10
|
+
const config = loadConfig();
|
|
11
|
+
const wallet = getWallet(config, opts.wallet);
|
|
12
|
+
const client = createHttpClient({ baseUrl: getApiUrl(config) });
|
|
13
|
+
if (opts.account) {
|
|
14
|
+
// Direct PDA sync
|
|
15
|
+
validateAddress(opts.account, 'account');
|
|
16
|
+
const res = await client.get(`/api/account/${opts.account}`);
|
|
17
|
+
const acct = res.data.data;
|
|
18
|
+
// Verify wallet is an operator on this account
|
|
19
|
+
const op = acct.operators.find((o) => o.pubkey === wallet.address);
|
|
20
|
+
if (!op) {
|
|
21
|
+
throw new SdkError('NOT_OPERATOR', `Wallet "${wallet.label}" (${wallet.address}) is not an operator on account ${opts.account}`);
|
|
22
|
+
}
|
|
23
|
+
const accountInfo = {
|
|
24
|
+
pda: acct.pda,
|
|
25
|
+
owner: acct.owner,
|
|
26
|
+
mint: acct.mint,
|
|
27
|
+
mintDecimals: acct.mintDecimals,
|
|
28
|
+
operatorIndex: op.index,
|
|
29
|
+
perTxLimit: Number(op.perTxLimit),
|
|
30
|
+
syncedAt: new Date().toISOString(),
|
|
31
|
+
};
|
|
32
|
+
config.account = accountInfo;
|
|
33
|
+
saveConfig(config);
|
|
34
|
+
outputSuccess({
|
|
35
|
+
action: 'sync',
|
|
36
|
+
pda: acct.pda,
|
|
37
|
+
owner: acct.owner,
|
|
38
|
+
balance: acct.balance,
|
|
39
|
+
perTxLimit: Number(op.perTxLimit),
|
|
40
|
+
mint: acct.mint,
|
|
41
|
+
});
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// Discover by operator
|
|
45
|
+
const res = await client.get(`/api/account/by-operator/${wallet.address}`);
|
|
46
|
+
const accounts = res.data.data.accounts;
|
|
47
|
+
if (accounts.length === 0) {
|
|
48
|
+
outputSuccess({
|
|
49
|
+
action: 'sync',
|
|
50
|
+
found: 0,
|
|
51
|
+
message: `No account found for wallet "${wallet.label}" (${wallet.address}).`,
|
|
52
|
+
hint: `Ask your human to set up your account at:\n https://app.silkyway.ai/account/setup?agent=${wallet.address}`,
|
|
53
|
+
});
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// Auto-select first account
|
|
57
|
+
const selected = accounts[0];
|
|
58
|
+
const slot = selected.operatorSlot;
|
|
59
|
+
const accountInfo = {
|
|
60
|
+
pda: selected.pda,
|
|
61
|
+
owner: selected.owner,
|
|
62
|
+
mint: selected.mint,
|
|
63
|
+
mintDecimals: selected.mintDecimals,
|
|
64
|
+
operatorIndex: slot.index,
|
|
65
|
+
perTxLimit: Number(slot.perTxLimit),
|
|
66
|
+
syncedAt: new Date().toISOString(),
|
|
67
|
+
};
|
|
68
|
+
config.account = accountInfo;
|
|
69
|
+
saveConfig(config);
|
|
70
|
+
if (accounts.length === 1) {
|
|
71
|
+
outputSuccess({
|
|
72
|
+
action: 'sync',
|
|
73
|
+
pda: selected.pda,
|
|
74
|
+
owner: selected.owner,
|
|
75
|
+
balance: selected.balance,
|
|
76
|
+
perTxLimit: Number(slot.perTxLimit),
|
|
77
|
+
mint: selected.mint,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
outputSuccess({
|
|
82
|
+
action: 'sync',
|
|
83
|
+
pda: selected.pda,
|
|
84
|
+
owner: selected.owner,
|
|
85
|
+
balance: selected.balance,
|
|
86
|
+
perTxLimit: Number(slot.perTxLimit),
|
|
87
|
+
mint: selected.mint,
|
|
88
|
+
allAccounts: accounts.map((a) => ({
|
|
89
|
+
pda: a.pda,
|
|
90
|
+
owner: a.owner,
|
|
91
|
+
balance: a.balance,
|
|
92
|
+
})),
|
|
93
|
+
hint: 'To use a different account: silk account sync --account <pda>',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export async function accountStatus(opts) {
|
|
98
|
+
const config = loadConfig();
|
|
99
|
+
getWallet(config, opts.wallet); // validate wallet exists
|
|
100
|
+
if (!config.account) {
|
|
101
|
+
throw new SdkError('NO_ACCOUNT', 'No account synced. Run: silk account sync');
|
|
102
|
+
}
|
|
103
|
+
const client = createHttpClient({ baseUrl: getApiUrl(config) });
|
|
104
|
+
const res = await client.get(`/api/account/${config.account.pda}`);
|
|
105
|
+
const acct = res.data.data;
|
|
106
|
+
const op = acct.operators.find((o) => o.index === config.account.operatorIndex);
|
|
107
|
+
const perTxLimit = op ? Number(op.perTxLimit) : config.account.perTxLimit;
|
|
108
|
+
const perTxLimitHuman = acct.mintDecimals > 0 ? perTxLimit / 10 ** acct.mintDecimals : perTxLimit;
|
|
109
|
+
outputSuccess({
|
|
110
|
+
action: 'status',
|
|
111
|
+
pda: acct.pda,
|
|
112
|
+
owner: acct.owner,
|
|
113
|
+
balance: acct.balance,
|
|
114
|
+
mint: acct.mint,
|
|
115
|
+
isPaused: acct.isPaused,
|
|
116
|
+
operatorIndex: config.account.operatorIndex,
|
|
117
|
+
perTxLimit: perTxLimitHuman,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
export async function accountSend(recipient, amount, opts) {
|
|
121
|
+
recipient = resolveRecipient(recipient);
|
|
122
|
+
const config = loadConfig();
|
|
123
|
+
const wallet = getWallet(config, opts.wallet);
|
|
124
|
+
if (!config.account) {
|
|
125
|
+
throw new SdkError('NO_ACCOUNT', 'No account synced. Run: silk account sync');
|
|
126
|
+
}
|
|
127
|
+
validateAddress(recipient, 'recipient');
|
|
128
|
+
const amountNum = validateAmount(amount);
|
|
129
|
+
// Convert to smallest units
|
|
130
|
+
const amountRaw = Math.round(amountNum * 10 ** config.account.mintDecimals);
|
|
131
|
+
const client = createHttpClient({ baseUrl: getApiUrl(config) });
|
|
132
|
+
// 1. Build unsigned transaction
|
|
133
|
+
const buildRes = await client.post('/api/account/transfer', {
|
|
134
|
+
signer: wallet.address,
|
|
135
|
+
accountPda: config.account.pda,
|
|
136
|
+
recipient,
|
|
137
|
+
amount: amountRaw,
|
|
138
|
+
});
|
|
139
|
+
const { transaction: txBase64 } = buildRes.data.data;
|
|
140
|
+
// 2. Sign the transaction
|
|
141
|
+
const tx = Transaction.from(Buffer.from(txBase64, 'base64'));
|
|
142
|
+
const keypair = Keypair.fromSecretKey(bs58.decode(wallet.privateKey));
|
|
143
|
+
tx.sign(keypair);
|
|
144
|
+
// 3. Submit signed transaction
|
|
145
|
+
try {
|
|
146
|
+
const submitRes = await client.post('/api/tx/submit', {
|
|
147
|
+
signedTx: tx.serialize().toString('base64'),
|
|
148
|
+
});
|
|
149
|
+
const { txid } = submitRes.data.data;
|
|
150
|
+
outputSuccess({ action: 'send', txid, amount: amountNum, recipient });
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
throw toSilkysigError(err);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/commands/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAe,MAAM,cAAc,CAAC;AACz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AQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEjB,+BAA+B;IAC/B,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACpD,QAAQ,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;SAC5C,CAAC,CAAC;QAEH,MAAM,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QACrC,aAAa,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;IACxE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,eAAe,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { loadConfig, getWallet, getApiUrl } from '../config.js';
|
|
2
|
+
import { createHttpClient } from '../client.js';
|
|
3
|
+
import { outputSuccess } from '../output.js';
|
|
4
|
+
export async function balance(opts) {
|
|
5
|
+
const config = loadConfig();
|
|
6
|
+
const wallet = getWallet(config, opts.wallet);
|
|
7
|
+
const client = createHttpClient({ baseUrl: getApiUrl(config) });
|
|
8
|
+
const res = await client.get(`/api/wallet/${wallet.address}/balance`);
|
|
9
|
+
const data = res.data.data;
|
|
10
|
+
outputSuccess({ wallet: wallet.label, address: wallet.address, sol: data.sol, tokens: data.tokens });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=balance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../src/commands/balance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAyB;IACrD,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAEhE,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;IACtE,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;IAE3B,aAAa,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AACvG,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Keypair, Transaction } from '@solana/web3.js';
|
|
2
|
+
import bs58 from 'bs58';
|
|
3
|
+
import { loadConfig, getWallet, getApiUrl } from '../config.js';
|
|
4
|
+
import { createHttpClient } from '../client.js';
|
|
5
|
+
import { outputSuccess } from '../output.js';
|
|
6
|
+
import { validateCancel } from '../validate.js';
|
|
7
|
+
export async function cancel(transferPda, opts) {
|
|
8
|
+
const config = loadConfig();
|
|
9
|
+
const wallet = getWallet(config, opts.wallet);
|
|
10
|
+
const client = createHttpClient({ baseUrl: getApiUrl(config) });
|
|
11
|
+
await validateCancel(client, transferPda, wallet.address);
|
|
12
|
+
// 1. Build unsigned cancel tx
|
|
13
|
+
const buildRes = await client.post('/api/tx/cancel-transfer', {
|
|
14
|
+
canceller: wallet.address,
|
|
15
|
+
transferPda,
|
|
16
|
+
});
|
|
17
|
+
const txBase64 = buildRes.data.data.transaction;
|
|
18
|
+
// 2. Sign
|
|
19
|
+
const tx = Transaction.from(Buffer.from(txBase64, 'base64'));
|
|
20
|
+
const keypair = Keypair.fromSecretKey(bs58.decode(wallet.privateKey));
|
|
21
|
+
tx.sign(keypair);
|
|
22
|
+
// 3. Submit
|
|
23
|
+
const submitRes = await client.post('/api/tx/submit', {
|
|
24
|
+
signedTx: tx.serialize().toString('base64'),
|
|
25
|
+
});
|
|
26
|
+
outputSuccess({ action: 'cancel', transferPda, txid: submitRes.data.data.txid });
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=cancel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../src/commands/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,WAAmB,EAAE,IAAyB;IACzE,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAEhE,MAAM,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAE1D,8BAA8B;IAC9B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE;QAC5D,SAAS,EAAE,MAAM,CAAC,OAAO;QACzB,WAAW;KACZ,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;IAEhD,UAAU;IACV,MAAM,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEjB,YAAY;IACZ,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE;QACpD,QAAQ,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;KAC5C,CAAC,CAAC;IAEH,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function chat(message: string): Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { loadConfig, getApiUrl, getAgentId } from '../config.js';
|
|
2
|
+
import { createHttpClient } from '../client.js';
|
|
3
|
+
import { outputSuccess } from '../output.js';
|
|
4
|
+
export async function chat(message) {
|
|
5
|
+
const config = loadConfig();
|
|
6
|
+
const agentId = getAgentId(config);
|
|
7
|
+
const client = createHttpClient({ baseUrl: getApiUrl(config) });
|
|
8
|
+
const res = await client.post('/chat', { agentId, message });
|
|
9
|
+
const data = res.data.data;
|
|
10
|
+
outputSuccess({ message: data.message });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAe;IACxC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAEhE,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;IAE3B,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Keypair, Transaction } from '@solana/web3.js';
|
|
2
|
+
import bs58 from 'bs58';
|
|
3
|
+
import { loadConfig, getWallet, getApiUrl } from '../config.js';
|
|
4
|
+
import { createHttpClient } from '../client.js';
|
|
5
|
+
import { outputSuccess } from '../output.js';
|
|
6
|
+
import { validateClaim } from '../validate.js';
|
|
7
|
+
export async function claim(transferPda, opts) {
|
|
8
|
+
const config = loadConfig();
|
|
9
|
+
const wallet = getWallet(config, opts.wallet);
|
|
10
|
+
const client = createHttpClient({ baseUrl: getApiUrl(config) });
|
|
11
|
+
await validateClaim(client, transferPda, wallet.address);
|
|
12
|
+
// 1. Build unsigned claim tx
|
|
13
|
+
const buildRes = await client.post('/api/tx/claim-transfer', {
|
|
14
|
+
claimer: wallet.address,
|
|
15
|
+
transferPda,
|
|
16
|
+
});
|
|
17
|
+
const txBase64 = buildRes.data.data.transaction;
|
|
18
|
+
// 2. Sign
|
|
19
|
+
const tx = Transaction.from(Buffer.from(txBase64, 'base64'));
|
|
20
|
+
const keypair = Keypair.fromSecretKey(bs58.decode(wallet.privateKey));
|
|
21
|
+
tx.sign(keypair);
|
|
22
|
+
// 3. Submit
|
|
23
|
+
const submitRes = await client.post('/api/tx/submit', {
|
|
24
|
+
signedTx: tx.serialize().toString('base64'),
|
|
25
|
+
});
|
|
26
|
+
outputSuccess({ action: 'claim', transferPda, txid: submitRes.data.data.txid });
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=claim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim.js","sourceRoot":"","sources":["../../src/commands/claim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,WAAmB,EAAE,IAAyB;IACxE,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAEhE,MAAM,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAEzD,6BAA6B;IAC7B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE;QAC3D,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW;KACZ,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;IAEhD,UAAU;IACV,MAAM,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEjB,YAAY;IACZ,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE;QACpD,QAAQ,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;KAC5C,CAAC,CAAC;IAEH,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function configSetApiUrl(url: string): Promise<void>;
|
|
2
|
+
export declare function configGetApiUrl(): Promise<void>;
|
|
3
|
+
export declare function configResetApiUrl(): Promise<void>;
|
|
4
|
+
export declare function configSetCluster(cluster: string): Promise<void>;
|
|
5
|
+
export declare function configGetCluster(): Promise<void>;
|
|
6
|
+
export declare function configResetCluster(): Promise<void>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { loadConfig, saveConfig, getApiUrl, getCluster } from '../config.js';
|
|
2
|
+
import { outputSuccess } from '../output.js';
|
|
3
|
+
import { SdkError } from '../errors.js';
|
|
4
|
+
export async function configSetApiUrl(url) {
|
|
5
|
+
const config = loadConfig();
|
|
6
|
+
config.apiUrl = url;
|
|
7
|
+
saveConfig(config);
|
|
8
|
+
outputSuccess({ apiUrl: url });
|
|
9
|
+
}
|
|
10
|
+
export async function configGetApiUrl() {
|
|
11
|
+
const config = loadConfig();
|
|
12
|
+
outputSuccess({ apiUrl: getApiUrl(config) });
|
|
13
|
+
}
|
|
14
|
+
export async function configResetApiUrl() {
|
|
15
|
+
const config = loadConfig();
|
|
16
|
+
delete config.apiUrl;
|
|
17
|
+
saveConfig(config);
|
|
18
|
+
outputSuccess({ apiUrl: getApiUrl(config), message: 'Reset to default' });
|
|
19
|
+
}
|
|
20
|
+
const VALID_CLUSTERS = ['mainnet-beta', 'devnet'];
|
|
21
|
+
export async function configSetCluster(cluster) {
|
|
22
|
+
if (!VALID_CLUSTERS.includes(cluster)) {
|
|
23
|
+
throw new SdkError('INVALID_CLUSTER', `Invalid cluster "${cluster}". Valid options: ${VALID_CLUSTERS.join(', ')}`);
|
|
24
|
+
}
|
|
25
|
+
const config = loadConfig();
|
|
26
|
+
config.cluster = cluster;
|
|
27
|
+
saveConfig(config);
|
|
28
|
+
outputSuccess({ cluster, apiUrl: getApiUrl(config) });
|
|
29
|
+
}
|
|
30
|
+
export async function configGetCluster() {
|
|
31
|
+
const config = loadConfig();
|
|
32
|
+
outputSuccess({ cluster: getCluster(config), apiUrl: getApiUrl(config) });
|
|
33
|
+
}
|
|
34
|
+
export async function configResetCluster() {
|
|
35
|
+
const config = loadConfig();
|
|
36
|
+
delete config.cluster;
|
|
37
|
+
saveConfig(config);
|
|
38
|
+
outputSuccess({ cluster: getCluster(config), apiUrl: getApiUrl(config), message: 'Reset to default (mainnet-beta)' });
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAiB,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAW;IAC/C,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC;IACpB,UAAU,CAAC,MAAM,CAAC,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,OAAO,MAAM,CAAC,MAAM,CAAC;IACrB,UAAU,CAAC,MAAM,CAAC,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,cAAc,GAAoB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAEnE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAe;IACpD,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAwB,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,QAAQ,CAAC,iBAAiB,EAAE,oBAAoB,OAAO,qBAAqB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrH,CAAC;IACD,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,CAAC,OAAO,GAAG,OAAwB,CAAC;IAC1C,UAAU,CAAC,MAAM,CAAC,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,OAAO,MAAM,CAAC,OAAO,CAAC;IACtB,UAAU,CAAC,MAAM,CAAC,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC,CAAC;AACxH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function contactsAdd(name: string, address: string): Promise<void>;
|
|
2
|
+
export declare function contactsRemove(name: string): Promise<void>;
|
|
3
|
+
export declare function contactsList(): Promise<void>;
|
|
4
|
+
export declare function contactsGet(name: string): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { addContact, removeContact, getContact, listContacts } from '../contacts.js';
|
|
2
|
+
import { outputSuccess } from '../output.js';
|
|
3
|
+
import { SdkError } from '../errors.js';
|
|
4
|
+
export async function contactsAdd(name, address) {
|
|
5
|
+
addContact(name, address);
|
|
6
|
+
outputSuccess({ action: 'contact_added', name: name.toLowerCase(), address });
|
|
7
|
+
}
|
|
8
|
+
export async function contactsRemove(name) {
|
|
9
|
+
removeContact(name);
|
|
10
|
+
outputSuccess({ action: 'contact_removed', name: name.toLowerCase() });
|
|
11
|
+
}
|
|
12
|
+
export async function contactsList() {
|
|
13
|
+
const contacts = listContacts();
|
|
14
|
+
outputSuccess({ action: 'contacts_list', contacts });
|
|
15
|
+
}
|
|
16
|
+
export async function contactsGet(name) {
|
|
17
|
+
const contact = getContact(name);
|
|
18
|
+
if (!contact) {
|
|
19
|
+
throw new SdkError('CONTACT_NOT_FOUND', `Contact "${name.toLowerCase()}" not found`);
|
|
20
|
+
}
|
|
21
|
+
outputSuccess({ action: 'contact_get', name: contact.name, address: contact.address });
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=contacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/commands/contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,OAAe;IAC7D,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,aAAa,CAAC,IAAI,CAAC,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EA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