hak-saucerswap-plugin 2.0.0 → 2.1.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 +27 -3
- package/dist/index.cjs +987 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +986 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,25 +32,49 @@ npm install hak-saucerswap-plugin
|
|
|
32
32
|
## Quick Start
|
|
33
33
|
|
|
34
34
|
```ts
|
|
35
|
-
import { saucerswapPlugin } from "hak-saucerswap-plugin";
|
|
35
|
+
import { saucerswapPlugin, SAUCERSWAP_MAINNET } from "hak-saucerswap-plugin";
|
|
36
36
|
|
|
37
37
|
const agent = new HederaAgent({
|
|
38
38
|
plugins: [saucerswapPlugin],
|
|
39
39
|
config: {
|
|
40
40
|
saucerswap: {
|
|
41
|
+
...SAUCERSWAP_MAINNET,
|
|
41
42
|
apiKey: process.env.SAUCERSWAP_API_KEY,
|
|
42
|
-
routerV2ContractId: "0.0.1414040",
|
|
43
|
-
wrappedHbarTokenId: "0.0.15058",
|
|
44
43
|
},
|
|
45
44
|
},
|
|
46
45
|
});
|
|
47
46
|
```
|
|
48
47
|
|
|
48
|
+
Or use the `network` shorthand and set `SAUCERSWAP_NETWORK=mainnet` in your environment — no
|
|
49
|
+
contract addresses needed:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
const agent = new HederaAgent({
|
|
53
|
+
plugins: [saucerswapPlugin],
|
|
54
|
+
config: {
|
|
55
|
+
saucerswap: { network: "mainnet", apiKey: process.env.SAUCERSWAP_API_KEY },
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
49
60
|
The SaucerSwap API requires an `x-api-key` header. Get a key from
|
|
50
61
|
[saucerswap.finance](https://www.saucerswap.finance) and supply it via either
|
|
51
62
|
`SAUCERSWAP_API_KEY` in the environment or `config.saucerswap.apiKey`. See
|
|
52
63
|
[`.env.example`](./.env.example) for a copy-paste template of all supported environment variables.
|
|
53
64
|
|
|
65
|
+
## Network Defaults
|
|
66
|
+
|
|
67
|
+
The plugin ships with official contract addresses for both networks. Import the constants
|
|
68
|
+
directly or use the `network` shorthand — individual fields always take precedence if set.
|
|
69
|
+
|
|
70
|
+
| Export | Network | routerContractId | routerV2ContractId | wrappedHbarTokenId |
|
|
71
|
+
|----------------------|---------|------------------|--------------------|-------------------|
|
|
72
|
+
| `SAUCERSWAP_MAINNET` | mainnet | `0.0.3045981` | `0.0.3949434` | `0.0.1456986` |
|
|
73
|
+
| `SAUCERSWAP_TESTNET` | testnet | `0.0.19264` | `0.0.1414040` | `0.0.15058` |
|
|
74
|
+
|
|
75
|
+
Both constants also include `tokenAliases` for `SAUCE` and `XSAUCE`. Contract addresses sourced
|
|
76
|
+
from the [official SaucerSwap deployment docs](https://docs.saucerswap.finance/developerx/contract-deployments).
|
|
77
|
+
|
|
54
78
|
## Development
|
|
55
79
|
|
|
56
80
|
```bash
|