@sun-protocol/sun-sdk-core 0.1.0-beta.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/NOTICE.md +5 -0
- package/README.md +34 -0
- package/dist/index.cjs +1594 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +628 -0
- package/dist/index.d.ts +628 -0
- package/dist/index.js +1494 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -0
package/NOTICE.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @sun-protocol/sun-sdk-core Notice
|
|
2
|
+
|
|
3
|
+
This package is derived from Uniswap SDK Core source code, used under the MIT license.
|
|
4
|
+
|
|
5
|
+
Sun SDK keeps the upstream `sdk-core/src` directory shape and Token/Currency/Fraction semantics so SunSwap V2/V3/V4 packages can align with the Uniswap SDK architecture. TRON-specific changes are limited to Sun compatibility exports and native wrapped token constants such as WTRX.
|
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @sun-protocol/sun-sdk-core
|
|
2
|
+
|
|
3
|
+
Shared currency, amount, address, error, intent, and transaction action primitives for SUN SDK.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @sun-protocol/sun-sdk-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Percent, createContractCallAction } from '@sun-protocol/sun-sdk-core'
|
|
15
|
+
|
|
16
|
+
const slippage = new Percent(50, 10_000)
|
|
17
|
+
const action = createContractCallAction({
|
|
18
|
+
id: 'approve-token',
|
|
19
|
+
target: token,
|
|
20
|
+
functionSelector: 'approve(address,uint256)',
|
|
21
|
+
parameters: [
|
|
22
|
+
{ type: 'address', value: spender },
|
|
23
|
+
{ type: 'uint256', value: '1000000' },
|
|
24
|
+
],
|
|
25
|
+
})
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Primary exports include `Token`, `CurrencyAmount`, `Fraction`, `Percent`, `Price`, WTRX constants, TRON address helpers, `SDKError`, intents, and transaction action factories.
|
|
29
|
+
|
|
30
|
+
Core has no protocol orchestration and never accesses a wallet, signs, or broadcasts. `Token` uses EVM-style addresses for Uniswap-compatible math, while runtime actions use TRON base58 addresses.
|
|
31
|
+
|
|
32
|
+
Requires Node.js 20 or a compatible JavaScript runtime.
|
|
33
|
+
|
|
34
|
+
[Full API documentation](https://github.com/sun-protocol/sun-sdk/blob/main/docs/sdk/api/core.md)
|