zano_web3 10.1.0 → 10.2.0
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/README.md +17 -142
- package/package.json +2 -5
- package/web/dist/constants/common/index.d.ts +4 -0
- package/web/dist/constants/common/index.js +12 -0
- package/web/dist/constants/common/index.js.map +1 -0
- package/web/dist/constants/index.d.ts +1 -0
- package/web/dist/constants/index.js +2 -0
- package/web/dist/constants/index.js.map +1 -0
- package/web/dist/index.d.ts +1 -0
- package/web/dist/index.js +1 -0
- package/web/dist/index.js.map +1 -1
- package/web/dist/types/params/companion-requests/accept-ionic-swap/index.d.ts +3 -0
- package/web/dist/types/params/companion-requests/accept-ionic-swap/index.js +2 -0
- package/web/dist/types/params/companion-requests/accept-ionic-swap/index.js.map +1 -0
- package/web/dist/types/params/companion-requests/add-whitelist-asset/index.d.ts +3 -0
- package/web/dist/types/params/companion-requests/add-whitelist-asset/index.js +2 -0
- package/web/dist/types/params/companion-requests/add-whitelist-asset/index.js.map +1 -0
- package/web/dist/types/params/companion-requests/burn-asset/index.d.ts +28 -0
- package/web/dist/types/params/companion-requests/burn-asset/index.js +2 -0
- package/web/dist/types/params/companion-requests/burn-asset/index.js.map +1 -0
- package/web/dist/types/params/companion-requests/create-alias/index.d.ts +3 -0
- package/web/dist/types/params/companion-requests/create-alias/index.js +2 -0
- package/web/dist/types/params/companion-requests/create-alias/index.js.map +1 -0
- package/web/dist/types/params/companion-requests/get-address-by-alias/index.d.ts +3 -0
- package/web/dist/types/params/companion-requests/get-address-by-alias/index.js +2 -0
- package/web/dist/types/params/companion-requests/get-address-by-alias/index.js.map +1 -0
- package/web/dist/types/params/companion-requests/get-ionic-swap-info/index.d.ts +3 -0
- package/web/dist/types/params/companion-requests/get-ionic-swap-info/index.js +2 -0
- package/web/dist/types/params/companion-requests/get-ionic-swap-info/index.js.map +1 -0
- package/web/dist/types/params/companion-requests/index.d.ts +4 -1
- package/web/dist/types/params/companion-requests/initialize-ionic-swap/index.d.ts +14 -0
- package/web/dist/types/params/companion-requests/initialize-ionic-swap/index.js +2 -0
- package/web/dist/types/params/companion-requests/initialize-ionic-swap/index.js.map +1 -0
- package/web/dist/types/params/companion-requests/request-message-sign/index.d.ts +3 -0
- package/web/dist/types/params/companion-requests/request-message-sign/index.js +2 -0
- package/web/dist/types/params/companion-requests/request-message-sign/index.js.map +1 -0
- package/web/dist/types/params/companion-requests/request-permissions/index.d.ts +7 -2
- package/web/dist/types/params/companion-requests/transfer/index.d.ts +22 -0
- package/web/dist/types/params/companion-requests/transfer/index.js +2 -0
- package/web/dist/types/params/companion-requests/transfer/index.js.map +1 -0
- package/web/dist/types/responses/companion-methods/accept-ionic-swap/index.d.ts +24 -0
- package/web/dist/types/responses/companion-methods/accept-ionic-swap/index.js +21 -0
- package/web/dist/types/responses/companion-methods/accept-ionic-swap/index.js.map +1 -0
- package/web/dist/types/responses/companion-methods/add-whitelist-asset/index.d.ts +48 -0
- package/web/dist/types/responses/companion-methods/add-whitelist-asset/index.js +40 -0
- package/web/dist/types/responses/companion-methods/add-whitelist-asset/index.js.map +1 -0
- package/web/dist/types/responses/companion-methods/burn-asset/index.d.ts +24 -0
- package/web/dist/types/responses/companion-methods/burn-asset/index.js +21 -0
- package/web/dist/types/responses/companion-methods/burn-asset/index.js.map +1 -0
- package/web/dist/types/responses/companion-methods/create-alias/index.d.ts +14 -1
- package/web/dist/types/responses/companion-methods/create-alias/index.js +12 -1
- package/web/dist/types/responses/companion-methods/create-alias/index.js.map +1 -1
- package/web/dist/types/responses/companion-methods/get-address-by-alias/index.d.ts +10 -2
- package/web/dist/types/responses/companion-methods/get-address-by-alias/index.js +7 -1
- package/web/dist/types/responses/companion-methods/get-address-by-alias/index.js.map +1 -1
- package/web/dist/types/responses/companion-methods/get-ionic-swap-info/index.d.ts +49 -0
- package/web/dist/types/responses/companion-methods/get-ionic-swap-info/index.js +32 -0
- package/web/dist/types/responses/companion-methods/get-ionic-swap-info/index.js.map +1 -0
- package/web/dist/types/responses/companion-methods/get-permissions/index.d.ts +21 -0
- package/web/dist/types/responses/companion-methods/get-permissions/index.js +10 -0
- package/web/dist/types/responses/companion-methods/get-permissions/index.js.map +1 -0
- package/web/dist/types/responses/companion-methods/get-wallet-balance/index.d.ts +73 -0
- package/web/dist/types/responses/companion-methods/get-wallet-balance/index.js +44 -0
- package/web/dist/types/responses/companion-methods/get-wallet-balance/index.js.map +1 -0
- package/web/dist/types/responses/companion-methods/get-whitelist/index.d.ts +29 -0
- package/web/dist/types/responses/companion-methods/get-whitelist/index.js +17 -0
- package/web/dist/types/responses/companion-methods/get-whitelist/index.js.map +1 -0
- package/web/dist/types/responses/companion-methods/index.d.ts +9 -0
- package/web/dist/types/responses/companion-methods/initialize-ionic-swap/index.d.ts +22 -0
- package/web/dist/types/responses/companion-methods/initialize-ionic-swap/index.js +21 -0
- package/web/dist/types/responses/companion-methods/initialize-ionic-swap/index.js.map +1 -0
- package/web/dist/types/responses/companion-methods/request-message-sign/index.d.ts +6 -2
- package/web/dist/types/responses/companion-methods/request-message-sign/index.js +13 -6
- package/web/dist/types/responses/companion-methods/request-message-sign/index.js.map +1 -1
- package/web/dist/types/responses/companion-methods/transfer/index.d.ts +35 -0
- package/web/dist/types/responses/companion-methods/transfer/index.js +25 -0
- package/web/dist/types/responses/companion-methods/transfer/index.js.map +1 -0
- package/web/dist/zano-wallet.d.ts +43 -6
- package/web/dist/zano-wallet.js +359 -14
- package/web/dist/zano-wallet.js.map +1 -1
- package/web/src/constants/common/index.ts +15 -0
- package/web/src/constants/index.ts +5 -0
- package/web/src/index.ts +1 -0
- package/web/src/types/params/companion-requests/accept-ionic-swap/index.ts +3 -0
- package/web/src/types/params/companion-requests/add-whitelist-asset/index.ts +3 -0
- package/web/src/types/params/companion-requests/burn-asset/index.ts +31 -0
- package/web/src/types/params/companion-requests/create-alias/index.ts +3 -0
- package/web/src/types/params/companion-requests/get-address-by-alias/index.ts +3 -0
- package/web/src/types/params/companion-requests/get-ionic-swap-info/index.ts +3 -0
- package/web/src/types/params/companion-requests/index.ts +4 -1
- package/web/src/types/params/companion-requests/initialize-ionic-swap/index.ts +15 -0
- package/web/src/types/params/companion-requests/request-message-sign/index.ts +3 -0
- package/web/src/types/params/companion-requests/request-permissions/index.ts +9 -2
- package/web/src/types/params/companion-requests/transfer/index.ts +17 -0
- package/web/src/types/responses/companion-methods/accept-ionic-swap/index.ts +33 -0
- package/web/src/types/responses/companion-methods/add-whitelist-asset/index.ts +53 -0
- package/web/src/types/responses/companion-methods/burn-asset/index.ts +33 -0
- package/web/src/types/responses/companion-methods/create-alias/index.ts +15 -1
- package/web/src/types/responses/companion-methods/get-address-by-alias/index.ts +13 -2
- package/web/src/types/responses/companion-methods/get-ionic-swap-info/index.ts +45 -0
- package/web/src/types/responses/companion-methods/get-permissions/index.ts +24 -0
- package/web/src/types/responses/companion-methods/get-wallet-balance/index.ts +57 -0
- package/web/src/types/responses/companion-methods/get-whitelist/index.ts +30 -0
- package/web/src/types/responses/companion-methods/index.ts +10 -1
- package/web/src/types/responses/companion-methods/initialize-ionic-swap/index.ts +31 -0
- package/web/src/types/responses/companion-methods/request-message-sign/index.ts +13 -6
- package/web/src/types/responses/companion-methods/transfer/index.ts +38 -0
- package/web/src/zano-wallet.ts +470 -15
package/README.md
CHANGED
|
@@ -37,162 +37,37 @@ import ZanoWallet from 'zano_web3/web';
|
|
|
37
37
|
|
|
38
38
|
### Creating a ZanoWallet Instance
|
|
39
39
|
|
|
40
|
-
To create a `ZanoWallet` instance, you need to provide configuration options via the `ZanoWalletParams` interface.
|
|
41
|
-
|
|
42
|
-
```typescript
|
|
43
|
-
const zanoWallet = new ZanoWallet({
|
|
44
|
-
authPath: '/api/auth', // Custom server path for authentication
|
|
45
|
-
useLocalStorage: true, // Store wallet credentials in local storage (default: true)
|
|
46
|
-
aliasRequired: false, // Whether an alias is required (optional)
|
|
47
|
-
customLocalStorageKey: 'myWalletKey', // Custom key for local storage (optional)
|
|
48
|
-
customNonce: 'customNonceValue', // Custom nonce for signing (optional)
|
|
49
|
-
disableServerRequest: false, // Disable server request after signing (optional)
|
|
50
|
-
|
|
51
|
-
onConnectStart: () => {
|
|
52
|
-
console.log('Connecting to ZanoWallet...');
|
|
53
|
-
},
|
|
54
|
-
onConnectEnd: (data) => {
|
|
55
|
-
console.log('Connected:', data);
|
|
56
|
-
},
|
|
57
|
-
onConnectError: (error) => {
|
|
58
|
-
console.error('Connection error:', error);
|
|
59
|
-
},
|
|
60
|
-
beforeConnect: async () => {
|
|
61
|
-
console.log('Preparing to connect...');
|
|
62
|
-
},
|
|
63
|
-
onLocalConnectEnd: (data) => {
|
|
64
|
-
console.log('Local connection established:', data);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### React / Next.js
|
|
70
|
-
|
|
71
|
-
For React or Next.js projects, you can use the `useZanoWallet` hook to create a `ZanoWallet` instance:
|
|
72
|
-
|
|
73
|
-
```tsx
|
|
74
|
-
|
|
75
|
-
import { useZanoWallet } from 'zano_web3/web';
|
|
76
|
-
|
|
77
|
-
const MyComponent = () => {
|
|
78
|
-
const zanoWallet = useZanoWallet({
|
|
79
|
-
// same options as for ZanoWallet constructor
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<div>
|
|
84
|
-
<button onClick={() => zanoWallet.connect()}>Connect to ZanoWallet</button>
|
|
85
|
-
</div>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Connecting to ZanoWallet
|
|
91
|
-
|
|
92
|
-
To initiate the connection process, call the `connect` method:
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
await zanoWallet.connect();
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Handling Wallet Credentials
|
|
99
|
-
|
|
100
|
-
You can manually manage wallet credentials using `getSavedWalletCredentials` and `setWalletCredentials` methods:
|
|
101
|
-
|
|
102
40
|
```typescript
|
|
103
|
-
const
|
|
104
|
-
if (credentials) {
|
|
105
|
-
console.log('Stored credentials:', credentials);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
zanoWallet.setWalletCredentials({
|
|
109
|
-
nonce: 'newNonce',
|
|
110
|
-
signature: 'newSignature',
|
|
111
|
-
publicKey: 'newPublicKey'
|
|
112
|
-
});
|
|
41
|
+
const zanoWallet = new ZanoWallet();
|
|
113
42
|
```
|
|
114
43
|
|
|
115
|
-
###
|
|
116
|
-
|
|
117
|
-
You can retrieve the wallet data using the `getWallet` method:
|
|
44
|
+
### ZanoWallet Instance Usage:
|
|
118
45
|
|
|
119
46
|
```typescript
|
|
120
|
-
|
|
121
|
-
console.log('Wallet data:', wallet);
|
|
122
|
-
```
|
|
47
|
+
// ...
|
|
123
48
|
|
|
124
|
-
|
|
49
|
+
let getWalletDataResult: GetWalletDataResponse;
|
|
125
50
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
To create a new alias, use the `createAlias` method:
|
|
136
|
-
|
|
137
|
-
```typescript
|
|
138
|
-
const newAliasData = await zanoWallet.createAlias('newAlias');
|
|
139
|
-
console.log('Alias created:', newAliasData);
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
## Exported Types
|
|
144
|
-
|
|
145
|
-
The following TypeScript interfaces are exported by the `zano_web3` library.
|
|
146
|
-
You can import them directly from library:
|
|
147
|
-
|
|
148
|
-
```typescript
|
|
149
|
-
import { Wallet, Asset, Transfer, Transaction } from 'zano_web3';
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
153
|
-
export interface Asset {
|
|
154
|
-
name: string;
|
|
155
|
-
ticker: string;
|
|
156
|
-
assetId: string;
|
|
157
|
-
decimalPoint: number;
|
|
158
|
-
balance: string;
|
|
159
|
-
unlockedBalance: string;
|
|
51
|
+
try {
|
|
52
|
+
getWalletDataResult = await zanoWallet.getWallet();
|
|
53
|
+
} catch (error) {
|
|
54
|
+
if (error instanceof ZanoWebError && error.code === 'ZANO_WALLET_NOT_AVAILABLE') {
|
|
55
|
+
// Error handling
|
|
56
|
+
} else {
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
160
59
|
}
|
|
161
60
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
assetId: string;
|
|
165
|
-
incoming: boolean;
|
|
61
|
+
if (!getWalletDataResult.success) {
|
|
62
|
+
// Error handling
|
|
166
63
|
}
|
|
167
64
|
|
|
168
|
-
|
|
169
|
-
isConfirmed: boolean;
|
|
170
|
-
txHash: string;
|
|
171
|
-
blobSize: number;
|
|
172
|
-
timestamp: number;
|
|
173
|
-
height: number;
|
|
174
|
-
paymentId: string;
|
|
175
|
-
comment: string;
|
|
176
|
-
fee: string;
|
|
177
|
-
isInitiator: boolean;
|
|
178
|
-
transfers: Transfer[];
|
|
179
|
-
}
|
|
65
|
+
const { data: walletData } = getWalletDataResult;
|
|
180
66
|
|
|
181
|
-
|
|
182
|
-
address: string;
|
|
183
|
-
alias: string;
|
|
184
|
-
balance: string;
|
|
185
|
-
assets: Asset[];
|
|
186
|
-
transactions: Transaction[];
|
|
187
|
-
}
|
|
67
|
+
// ...
|
|
188
68
|
```
|
|
189
69
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
- ZanoWallet browser extension must be installed.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
# Server api (Wallet RPC, Daemon):
|
|
70
|
+
# Server API (Wallet RPC, Daemon):
|
|
196
71
|
|
|
197
72
|
#### Methods
|
|
198
73
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zano_web3",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./web/dist/index.js",
|
|
@@ -38,16 +38,13 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@noble/hashes": "^2.2.0",
|
|
40
40
|
"@scure/base": "^2.2.0",
|
|
41
|
-
"axios": "^1.
|
|
41
|
+
"axios": "^1.18.1",
|
|
42
42
|
"big.js": "^6.2.1",
|
|
43
43
|
"decimal.js": "^10.4.3",
|
|
44
44
|
"json-bigint": "^1.0.0",
|
|
45
45
|
"node-forge": "^1.3.1",
|
|
46
46
|
"zod": "^4.4.3"
|
|
47
47
|
},
|
|
48
|
-
"peerDependencies": {
|
|
49
|
-
"react": "^18.3.1"
|
|
50
|
-
},
|
|
51
48
|
"devDependencies": {
|
|
52
49
|
"@types/big.js": "^6.2.2",
|
|
53
50
|
"@types/json-bigint": "^1.0.4",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const WALLET_RPC_GENERIC_ERROR_CODE = "WALLET_RPC_GENERIC_ERROR";
|
|
2
|
+
export declare const getWalletRPCErrorCode: (errorCode: number | undefined) => string;
|
|
3
|
+
export declare const getWalletRPCErrorCodeByStatus: (status: string) => string;
|
|
4
|
+
export declare const NON_NEGATIVE_REAL_NUMBER_REGEX: RegExp;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const WALLET_RPC_GENERIC_ERROR_CODE = 'WALLET_RPC_GENERIC_ERROR';
|
|
2
|
+
export const getWalletRPCErrorCode = (errorCode) => {
|
|
3
|
+
if (errorCode === undefined) {
|
|
4
|
+
return WALLET_RPC_GENERIC_ERROR_CODE;
|
|
5
|
+
}
|
|
6
|
+
return `WALLET_RPC_ERROR_${errorCode}`;
|
|
7
|
+
};
|
|
8
|
+
export const getWalletRPCErrorCodeByStatus = (status) => {
|
|
9
|
+
return `WALLET_RPC_ERROR_STATUS_${status}`;
|
|
10
|
+
};
|
|
11
|
+
export const NON_NEGATIVE_REAL_NUMBER_REGEX = /^\d+(\.\d+)?$/;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/common/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,6BAA6B,GAAG,0BAA0B,CAAC;AAExE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAA6B,EAAU,EAAE;IAC3E,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,6BAA6B,CAAC;IACzC,CAAC;IAED,OAAO,oBAAoB,SAAS,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,MAAc,EAAU,EAAE;IACpE,OAAO,2BAA2B,MAAM,EAAE,CAAC;AAC/C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WALLET_RPC_GENERIC_ERROR_CODE, getWalletRPCErrorCode, getWalletRPCErrorCodeByStatus } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,6BAA6B,EAC7B,qBAAqB,EACrB,6BAA6B,EAChC,MAAM,UAAU,CAAC"}
|
package/web/dist/index.d.ts
CHANGED
package/web/dist/index.js
CHANGED
package/web/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/params/companion-requests/accept-ionic-swap/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/params/companion-requests/add-whitelist-asset/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type ServiceEntriesType = {
|
|
2
|
+
body: string;
|
|
3
|
+
flags: number;
|
|
4
|
+
instruction: string;
|
|
5
|
+
security?: string;
|
|
6
|
+
service_id: string;
|
|
7
|
+
};
|
|
8
|
+
export type BurnAssetParams = {
|
|
9
|
+
assetId: string;
|
|
10
|
+
burnAmount: string;
|
|
11
|
+
nativeAmount?: string;
|
|
12
|
+
pointTxToAddress?: string;
|
|
13
|
+
serviceEntries?: ServiceEntriesType[];
|
|
14
|
+
};
|
|
15
|
+
export type CompanionServiceEntriesType = {
|
|
16
|
+
body: string;
|
|
17
|
+
flags: number;
|
|
18
|
+
instruction: string;
|
|
19
|
+
security?: string;
|
|
20
|
+
service_id: string;
|
|
21
|
+
};
|
|
22
|
+
export type CompanionBurnAssetParams = {
|
|
23
|
+
assetId: string;
|
|
24
|
+
burnAmount: string;
|
|
25
|
+
nativeAmount?: string;
|
|
26
|
+
pointTxToAddress?: string;
|
|
27
|
+
serviceEntries?: CompanionServiceEntriesType[];
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/params/companion-requests/burn-asset/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/params/companion-requests/create-alias/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/params/companion-requests/get-address-by-alias/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/params/companion-requests/get-ionic-swap-info/index.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { PermissionsParam } from './request-permissions';
|
|
2
|
+
export { InitializeIonicSwapParams } from './initialize-ionic-swap';
|
|
3
|
+
export { TransferParams } from './transfer';
|
|
4
|
+
export { BurnAssetParams, ServiceEntriesType } from './burn-asset';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type InitializeIonicSwapParams = {
|
|
2
|
+
destinationAssetID: string;
|
|
3
|
+
destinationAssetAmount: string;
|
|
4
|
+
currentAssetID: string;
|
|
5
|
+
currentAssetAmount: string;
|
|
6
|
+
destinationAddress: string;
|
|
7
|
+
};
|
|
8
|
+
export type CompanionIonicSwapParams = {
|
|
9
|
+
destinationAssetID: string;
|
|
10
|
+
destinationAssetAmount: string;
|
|
11
|
+
currentAssetID: string;
|
|
12
|
+
currentAssetAmount: string;
|
|
13
|
+
destinationAddress: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/params/companion-requests/initialize-ionic-swap/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/params/companion-requests/request-message-sign/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
export type CompanionRequestAccessParams = {
|
|
2
|
+
permissions: {
|
|
3
|
+
type: 'general' | 'balance' | 'history';
|
|
4
|
+
}[];
|
|
5
|
+
};
|
|
1
6
|
export type PermissionType = 'general' | 'balance' | 'history';
|
|
2
|
-
export interface
|
|
7
|
+
export interface Permission {
|
|
3
8
|
type: PermissionType;
|
|
4
9
|
}
|
|
5
|
-
export type
|
|
10
|
+
export type PermissionsParam = Permission[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type TransferParams = {
|
|
2
|
+
assetId: string;
|
|
3
|
+
amount: string;
|
|
4
|
+
destination: string;
|
|
5
|
+
} | {
|
|
6
|
+
assetId: string;
|
|
7
|
+
destinations: {
|
|
8
|
+
address: string;
|
|
9
|
+
amount: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
export type CompanionTransferParams = {
|
|
13
|
+
assetId: string;
|
|
14
|
+
amount: string;
|
|
15
|
+
destination: string;
|
|
16
|
+
} | {
|
|
17
|
+
assetId: string;
|
|
18
|
+
destinations: {
|
|
19
|
+
address: string;
|
|
20
|
+
amount: string;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/params/companion-requests/transfer/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const acceptIonicSwapCompanionResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
3
|
+
data: z.ZodUnion<readonly [z.ZodObject<{
|
|
4
|
+
result: z.ZodObject<{
|
|
5
|
+
result_tx_id: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
8
|
+
error: z.ZodObject<{
|
|
9
|
+
code: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
}, z.core.$strip>]>;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
error: z.ZodString;
|
|
14
|
+
}, z.core.$strip>]>;
|
|
15
|
+
export type AcceptIonicSwapCompanionResponse = z.infer<typeof acceptIonicSwapCompanionResponseSchema>;
|
|
16
|
+
export type AcceptIonicSwapResponse = {
|
|
17
|
+
success: true;
|
|
18
|
+
data: {
|
|
19
|
+
result_tx_id: string;
|
|
20
|
+
};
|
|
21
|
+
} | {
|
|
22
|
+
success: false;
|
|
23
|
+
error: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export const acceptIonicSwapCompanionResponseSchema = z.union([
|
|
3
|
+
z.object({
|
|
4
|
+
data: z.union([
|
|
5
|
+
z.object({
|
|
6
|
+
result: z.object({
|
|
7
|
+
result_tx_id: z.string(),
|
|
8
|
+
})
|
|
9
|
+
}),
|
|
10
|
+
z.object({
|
|
11
|
+
error: z.object({
|
|
12
|
+
code: z.number().optional(),
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
]),
|
|
16
|
+
}),
|
|
17
|
+
z.object({
|
|
18
|
+
error: z.string(),
|
|
19
|
+
})
|
|
20
|
+
]);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/responses/companion-methods/accept-ionic-swap/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,KAAK,CAAC;IAC1D,CAAC,CAAC,MAAM,CAAC;QACL,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC;YACV,CAAC,CAAC,MAAM,CAAC;gBACL,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;oBACb,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;iBAC3B,CAAC;aACL,CAAC;YACF,CAAC,CAAC,MAAM,CAAC;gBACL,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;oBACZ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;iBAC9B,CAAC;aACL,CAAC;SACL,CAAC;KACL,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACL,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
declare const addWhitelistAssetCompanionResponseAssetSchema: z.ZodObject<{
|
|
3
|
+
current_supply: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
4
|
+
decimal_point: z.ZodNumber;
|
|
5
|
+
full_name: z.ZodString;
|
|
6
|
+
hidden_supply: z.ZodBoolean;
|
|
7
|
+
meta_info: z.ZodString;
|
|
8
|
+
owner: z.ZodString;
|
|
9
|
+
owner_eth_pub_key: z.ZodString;
|
|
10
|
+
ticker: z.ZodString;
|
|
11
|
+
total_max_supply: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type AddWhitelistAssetResponseAsset = z.infer<typeof addWhitelistAssetCompanionResponseAssetSchema>;
|
|
14
|
+
export declare const addWhitelistAssetCompanionResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
15
|
+
data: z.ZodUnion<readonly [z.ZodObject<{
|
|
16
|
+
result: z.ZodUnion<readonly [z.ZodObject<{
|
|
17
|
+
asset_descriptor: z.ZodObject<{
|
|
18
|
+
current_supply: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
19
|
+
decimal_point: z.ZodNumber;
|
|
20
|
+
full_name: z.ZodString;
|
|
21
|
+
hidden_supply: z.ZodBoolean;
|
|
22
|
+
meta_info: z.ZodString;
|
|
23
|
+
owner: z.ZodString;
|
|
24
|
+
owner_eth_pub_key: z.ZodString;
|
|
25
|
+
ticker: z.ZodString;
|
|
26
|
+
total_max_supply: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
status: z.ZodLiteral<"OK">;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
status: z.ZodString;
|
|
31
|
+
}, z.core.$strip>]>;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
error: z.ZodObject<{
|
|
34
|
+
code: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
}, z.core.$strip>]>;
|
|
37
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
38
|
+
error: z.ZodString;
|
|
39
|
+
}, z.core.$strip>]>;
|
|
40
|
+
export type AddWhitelistAssetCompanionResponse = z.infer<typeof addWhitelistAssetCompanionResponseSchema>;
|
|
41
|
+
export type AddWhitelistAssetResponse = {
|
|
42
|
+
success: true;
|
|
43
|
+
data: AddWhitelistAssetResponseAsset;
|
|
44
|
+
} | {
|
|
45
|
+
success: false;
|
|
46
|
+
error: string;
|
|
47
|
+
};
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
const addWhitelistAssetCompanionResponseAssetSchema = z.object({
|
|
3
|
+
current_supply: z.union([z.string(), z.number()]),
|
|
4
|
+
decimal_point: z.number(),
|
|
5
|
+
full_name: z.string(),
|
|
6
|
+
hidden_supply: z.boolean(),
|
|
7
|
+
meta_info: z.string(),
|
|
8
|
+
owner: z.string(),
|
|
9
|
+
owner_eth_pub_key: z.string(),
|
|
10
|
+
ticker: z.string(),
|
|
11
|
+
total_max_supply: z.union([z.string(), z.number()])
|
|
12
|
+
});
|
|
13
|
+
export const addWhitelistAssetCompanionResponseSchema = z.union([
|
|
14
|
+
z.object({
|
|
15
|
+
data: z.union([
|
|
16
|
+
z.object({
|
|
17
|
+
result: z.union([
|
|
18
|
+
z.object({
|
|
19
|
+
asset_descriptor: addWhitelistAssetCompanionResponseAssetSchema,
|
|
20
|
+
status: z.literal('OK'),
|
|
21
|
+
}),
|
|
22
|
+
z.object({
|
|
23
|
+
status: z.string().refine((value) => value !== 'OK', {
|
|
24
|
+
message: 'Status must not be OK',
|
|
25
|
+
}),
|
|
26
|
+
})
|
|
27
|
+
])
|
|
28
|
+
}),
|
|
29
|
+
z.object({
|
|
30
|
+
error: z.object({
|
|
31
|
+
code: z.number().optional(),
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
])
|
|
35
|
+
}),
|
|
36
|
+
z.object({
|
|
37
|
+
error: z.string(),
|
|
38
|
+
})
|
|
39
|
+
]);
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/responses/companion-methods/add-whitelist-asset/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,6CAA6C,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3D,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACjD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC7B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;CACtD,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC,CAAC,KAAK,CAAC;IAC5D,CAAC,CAAC,MAAM,CAAC;QACL,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC;YACV,CAAC,CAAC,MAAM,CAAC;gBACL,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC;oBACZ,CAAC,CAAC,MAAM,CAAC;wBACL,gBAAgB,EAAE,6CAA6C;wBAC/D,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;qBAC1B,CAAC;oBACF,CAAC,CAAC,MAAM,CAAC;wBACL,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE;4BACjD,OAAO,EAAE,uBAAuB;yBACnC,CAAC;qBACL,CAAC;iBACL,CAAC;aACL,CAAC;YACF,CAAC,CAAC,MAAM,CAAC;gBACL,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;oBACZ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;iBAC9B,CAAC;aACL,CAAC;SACL,CAAC;KACL,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACL,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const burnAssetCompanionResponseScheme: z.ZodUnion<readonly [z.ZodObject<{
|
|
3
|
+
data: z.ZodUnion<readonly [z.ZodObject<{
|
|
4
|
+
result: z.ZodObject<{
|
|
5
|
+
tx_id: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
8
|
+
error: z.ZodObject<{
|
|
9
|
+
code: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
}, z.core.$strip>]>;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
error: z.ZodString;
|
|
14
|
+
}, z.core.$strip>]>;
|
|
15
|
+
export type BurnAssetCompanionResponse = z.infer<typeof burnAssetCompanionResponseScheme>;
|
|
16
|
+
export type BurnAssetResponse = {
|
|
17
|
+
success: true;
|
|
18
|
+
data: {
|
|
19
|
+
tx_id: string;
|
|
20
|
+
};
|
|
21
|
+
} | {
|
|
22
|
+
success: false;
|
|
23
|
+
error: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export const burnAssetCompanionResponseScheme = z.union([
|
|
3
|
+
z.object({
|
|
4
|
+
data: z.union([
|
|
5
|
+
z.object({
|
|
6
|
+
result: z.object({
|
|
7
|
+
tx_id: z.string(),
|
|
8
|
+
})
|
|
9
|
+
}),
|
|
10
|
+
z.object({
|
|
11
|
+
error: z.object({
|
|
12
|
+
code: z.number().optional(),
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
]),
|
|
16
|
+
}),
|
|
17
|
+
z.object({
|
|
18
|
+
error: z.string(),
|
|
19
|
+
})
|
|
20
|
+
]);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/responses/companion-methods/burn-asset/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC;IACpD,CAAC,CAAC,MAAM,CAAC;QACL,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC;YACV,CAAC,CAAC,MAAM,CAAC;gBACL,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;oBACb,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;iBACpB,CAAC;aACL,CAAC;YACF,CAAC,CAAC,MAAM,CAAC;gBACL,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;oBACZ,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;iBAC9B,CAAC;aACL,CAAC;SACL,CAAC;KACL,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACL,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACL,CAAC,CAAC"}
|