@paxoslabs/amplify-sdk 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/README.md +18 -14
- package/dist/index.d.mts +241 -191
- package/dist/index.d.ts +241 -191
- package/dist/index.js +545 -276
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +545 -276
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -12
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ import { AmplifyClient } from '@paxoslabs/amplify-sdk'
|
|
|
45
45
|
|
|
46
46
|
const client = new AmplifyClient({ apiKey: process.env.PAXOS_LABS_API_KEY! })
|
|
47
47
|
|
|
48
|
-
const { vaults } = await client.vaults.list({ filter: 'chainId=1' })
|
|
48
|
+
const { vaults } = await client.amplify.vaults.list({ filter: 'chainId=1' })
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
The API key is sent as the `x-api-key` header and authenticates every request.
|
|
@@ -74,17 +74,17 @@ Each API area is exposed as a subclient on the `AmplifyClient` instance.
|
|
|
74
74
|
|
|
75
75
|
| Accessor | Purpose |
|
|
76
76
|
| :--- | :--- |
|
|
77
|
-
| `client.vaults` | List vaults and assets; fetch APYs, TVLs, compositions, supply caps, and liquidity shortfalls |
|
|
78
|
-
| `client.deposit` | Prepare deposit transactions |
|
|
79
|
-
| `client.smartDeposits` | Create a smart deposit address for a user |
|
|
80
|
-
| `client.withdraw` | Prepare and cancel withdrawals; calculate fees; list requests and volumes |
|
|
81
|
-
| `client.users` | Fetch user positions |
|
|
82
|
-
| `client.
|
|
77
|
+
| `client.amplify.vaults` | List vaults and assets; fetch APYs, TVLs, compositions, supply caps, and liquidity shortfalls |
|
|
78
|
+
| `client.amplify.deposit` | Prepare deposit transactions |
|
|
79
|
+
| `client.amplify.smartDeposits` | Create a smart deposit address for a user |
|
|
80
|
+
| `client.amplify.withdraw` | Prepare (`prepare`) and cancel (`cancel`) withdrawals; calculate fees (`calculateFee`); list requests (`listRequests`) and volumes (`getVolumes`) |
|
|
81
|
+
| `client.amplify.users` | Fetch user positions |
|
|
82
|
+
| `client.core.authorization` | Detect (`detect`) token authorization requirements (permit, approval, or already approved) |
|
|
83
83
|
|
|
84
84
|
### Example: prepare a deposit
|
|
85
85
|
|
|
86
86
|
```ts
|
|
87
|
-
const prepared = await client.deposit.
|
|
87
|
+
const prepared = await client.amplify.deposit.prepare({
|
|
88
88
|
vaultAddress,
|
|
89
89
|
depositAsset,
|
|
90
90
|
depositAmount,
|
|
@@ -99,7 +99,7 @@ const prepared = await client.deposit.prepareDeposit({
|
|
|
99
99
|
### Example: create a smart deposit address
|
|
100
100
|
|
|
101
101
|
```ts
|
|
102
|
-
const { smartDepositAddress } = await client.smartDeposits.getAddress({
|
|
102
|
+
const { smartDepositAddress } = await client.amplify.smartDeposits.getAddress({
|
|
103
103
|
userDestinationAddress,
|
|
104
104
|
vaultAddress,
|
|
105
105
|
inputToken,
|
|
@@ -115,7 +115,7 @@ Requests reject with `AmplifyError` (carrying `statusCode` and `message`); reque
|
|
|
115
115
|
import { AmplifyError } from '@paxoslabs/amplify-sdk'
|
|
116
116
|
|
|
117
117
|
try {
|
|
118
|
-
await client.deposit.
|
|
118
|
+
await client.amplify.deposit.prepare(request)
|
|
119
119
|
} catch (err) {
|
|
120
120
|
if (err instanceof AmplifyError) {
|
|
121
121
|
console.error(err.statusCode, err.message)
|
|
@@ -126,14 +126,18 @@ try {
|
|
|
126
126
|
|
|
127
127
|
## Types
|
|
128
128
|
|
|
129
|
-
Generated
|
|
129
|
+
Generated types are available under the `Amplify` namespace:
|
|
130
130
|
|
|
131
131
|
```ts
|
|
132
132
|
import { Amplify } from '@paxoslabs/amplify-sdk'
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
// Response types are at the top level
|
|
135
|
+
type DepositResponse = Amplify.PrepareDepositResponseDto
|
|
136
|
+
type AuthResponse = Amplify.AuthorizationResponseDto
|
|
137
|
+
|
|
138
|
+
// Request types are nested under resource namespaces
|
|
139
|
+
type DepositRequest = Amplify.amplify.deposit.PrepareDepositRequest
|
|
140
|
+
type AuthRequest = Amplify.core.authorization.DetectAuthorizationRequest
|
|
137
141
|
```
|
|
138
142
|
|
|
139
143
|
## License
|