@flaunch/sdk 0.5.1 → 0.7.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 +25 -41
- package/dist/addresses/index.cjs +2 -3
- package/dist/addresses/index.cjs.map +1 -1
- package/dist/addresses/index.js +2 -3
- package/dist/addresses/index.js.map +1 -1
- package/dist/clients/FlaunchPositionManagerClient.d.ts.map +1 -1
- package/dist/clients/FlaunchPositionManagerV1_1Client.d.ts.map +1 -1
- package/dist/clients/Permit2Client.d.ts +16 -1
- package/dist/clients/Permit2Client.d.ts.map +1 -1
- package/dist/helpers/index.cjs +6 -7
- package/dist/helpers/index.cjs.map +1 -1
- package/dist/helpers/index.js +6 -7
- package/dist/helpers/index.js.map +1 -1
- package/dist/index.cjs.js +62 -25
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +62 -26
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/sdk/FlaunchSDK.d.ts +7 -6
- package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
- package/dist/sdk/factory.d.ts +21 -0
- package/dist/sdk/factory.d.ts.map +1 -0
- package/dist/utils/univ4.d.ts +1 -1
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -38,19 +38,19 @@ _Note: Add this `llms-full.txt` file into Cursor IDE / LLMs to provide context a
|
|
|
38
38
|
Using pnpm (recommended):
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
pnpm add @flaunch/sdk
|
|
41
|
+
pnpm add @flaunch/sdk
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Using npm:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
npm install @flaunch/sdk
|
|
47
|
+
npm install @flaunch/sdk
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
Using yarn:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
yarn add @flaunch/sdk
|
|
53
|
+
yarn add @flaunch/sdk
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
## Quick Start
|
|
@@ -58,9 +58,8 @@ yarn add @flaunch/sdk @delvtech/drift
|
|
|
58
58
|
Here's a simple example to get started with reading token metadata:
|
|
59
59
|
|
|
60
60
|
```ts
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import { viemAdapter } from "@delvtech/drift-viem";
|
|
61
|
+
import { createFlaunch } from "@flaunch/sdk";
|
|
62
|
+
import { createPublicClient, http } from "viem";
|
|
64
63
|
import { base } from "viem/chains";
|
|
65
64
|
|
|
66
65
|
const publicClient = createPublicClient({
|
|
@@ -68,48 +67,31 @@ const publicClient = createPublicClient({
|
|
|
68
67
|
transport: http(),
|
|
69
68
|
});
|
|
70
69
|
|
|
71
|
-
const
|
|
72
|
-
adapter: viemAdapter({ publicClient }),
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const flaunchRead = new ReadFlaunchSDK(base.id, drift);
|
|
70
|
+
const flaunchRead = createFlaunch({ publicClient });
|
|
76
71
|
const { symbol, name, image } = await flaunchRead.getCoinMetadata(coinAddress);
|
|
77
72
|
// returns: {symbol: "TEST", name: "Test", image: "https://<IMAGE_URL>"}
|
|
78
73
|
```
|
|
79
74
|
|
|
80
75
|
## Usage
|
|
81
76
|
|
|
82
|
-
The SDK
|
|
77
|
+
The SDK provides two types of operations:
|
|
83
78
|
|
|
84
|
-
1.
|
|
85
|
-
2.
|
|
79
|
+
1. Read operations: Only require a `publicClient`
|
|
80
|
+
2. Write operations: Require both `publicClient` and `walletClient`
|
|
86
81
|
|
|
87
82
|
### Read Operations (with Viem)
|
|
88
83
|
|
|
89
|
-
1. First, install the Viem adapter:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
pnpm add @delvtech/drift-viem
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
2. Initialize the SDK for read operations:
|
|
96
|
-
|
|
97
84
|
```ts
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
100
|
-
import {
|
|
101
|
-
import { base, baseSepolia } from "viem/chains";
|
|
85
|
+
import { createFlaunch } from "@flaunch/sdk";
|
|
86
|
+
import { createPublicClient, http } from "viem";
|
|
87
|
+
import { base } from "viem/chains";
|
|
102
88
|
|
|
103
89
|
const publicClient = createPublicClient({
|
|
104
90
|
chain: base,
|
|
105
91
|
transport: http("<RPC_URL>"), // "<RPC_URL>" is optional, defaults to public RPC
|
|
106
92
|
});
|
|
107
93
|
|
|
108
|
-
const
|
|
109
|
-
adapter: viemAdapter({ publicClient }),
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
const flaunchRead = new ReadFlaunchSDK(base.id, drift);
|
|
94
|
+
const flaunchRead = createFlaunch({ publicClient });
|
|
113
95
|
|
|
114
96
|
// Read token metadata
|
|
115
97
|
const { symbol, name, image } = await flaunchRead.getCoinMetadata(coinAddress);
|
|
@@ -121,25 +103,27 @@ const { symbol, name, image } = await flaunchRead.getCoinMetadata(coinAddress);
|
|
|
121
103
|
For write operations, you'll need both Viem and Wagmi. Here's how to set it up in a React component:
|
|
122
104
|
|
|
123
105
|
```ts
|
|
124
|
-
import {
|
|
125
|
-
import { createDrift } from "@delvtech/drift";
|
|
126
|
-
import { viemAdapter } from "@delvtech/drift-viem";
|
|
106
|
+
import { createFlaunch } from "@flaunch/sdk";
|
|
127
107
|
import { base } from "viem/chains";
|
|
128
108
|
import { useWalletClient } from "wagmi";
|
|
129
109
|
import { useMemo } from "react";
|
|
130
110
|
|
|
131
111
|
// ... your React component ...
|
|
132
112
|
|
|
113
|
+
const publicClient = createPublicClient({
|
|
114
|
+
chain: base,
|
|
115
|
+
transport: http("<RPC_URL>"), // "<RPC_URL>" is optional, defaults to public RPC
|
|
116
|
+
});
|
|
133
117
|
const { data: walletClient } = useWalletClient();
|
|
134
118
|
|
|
135
119
|
const flaunchWrite = useMemo(() => {
|
|
136
|
-
if (walletClient)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
}, [walletClient]);
|
|
120
|
+
if (!publicClient && !walletClient) return null;
|
|
121
|
+
|
|
122
|
+
return createFlaunch({
|
|
123
|
+
publicClient,
|
|
124
|
+
walletClient,
|
|
125
|
+
}) as ReadWriteFlaunchSDK;
|
|
126
|
+
}, [publicClient, walletClient]);
|
|
143
127
|
|
|
144
128
|
// Execute a buy transaction
|
|
145
129
|
const buyTokens = async () => {
|
package/dist/addresses/index.cjs
CHANGED
|
@@ -13,7 +13,7 @@ function defineChain(chain) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const version = '2.
|
|
16
|
+
const version = '2.29.2';
|
|
17
17
|
|
|
18
18
|
let errorConfig = {
|
|
19
19
|
getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
|
|
@@ -3245,7 +3245,6 @@ const formatters = {
|
|
|
3245
3245
|
});
|
|
3246
3246
|
return {
|
|
3247
3247
|
transactions,
|
|
3248
|
-
...(args.randomness ? { randomness: args.randomness } : {}),
|
|
3249
3248
|
};
|
|
3250
3249
|
},
|
|
3251
3250
|
}),
|
|
@@ -5148,7 +5147,7 @@ const sourceId$3 = 11_155_111; // sepolia
|
|
|
5148
5147
|
},
|
|
5149
5148
|
disputeGameFactory: {
|
|
5150
5149
|
[sourceId$3]: {
|
|
5151
|
-
address: '
|
|
5150
|
+
address: '0x8Ec1111f67Dad6b6A93B3F42DfBC92D81c98449A',
|
|
5152
5151
|
},
|
|
5153
5152
|
},
|
|
5154
5153
|
l2OutputOracle: {
|