@solana/kit-plugin-airdrop 0.3.0 → 0.5.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/dist/index.browser.cjs +10 -12
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs +10 -12
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.cjs +10 -12
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +10 -12
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.react-native.mjs +10 -12
- package/dist/index.react-native.mjs.map +1 -1
- package/dist/types/index.d.ts +2 -12
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.browser.cjs
CHANGED
|
@@ -6,24 +6,22 @@ var kit = require('@solana/kit');
|
|
|
6
6
|
function airdrop() {
|
|
7
7
|
return (client) => {
|
|
8
8
|
if ("svm" in client) {
|
|
9
|
-
|
|
10
|
-
client
|
|
11
|
-
|
|
9
|
+
return {
|
|
10
|
+
...client,
|
|
11
|
+
airdrop: (address, amount) => {
|
|
12
|
+
client.svm.airdrop(address, amount);
|
|
13
|
+
return Promise.resolve();
|
|
14
|
+
}
|
|
12
15
|
};
|
|
13
|
-
return { ...client, airdrop: airdrop3 };
|
|
14
16
|
}
|
|
15
17
|
const airdropInternal = kit.airdropFactory({
|
|
16
18
|
rpc: client.rpc,
|
|
17
19
|
rpcSubscriptions: client.rpcSubscriptions
|
|
18
20
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
commitment: "confirmed",
|
|
22
|
-
|
|
23
|
-
recipientAddress: address
|
|
24
|
-
}).then(() => {
|
|
25
|
-
});
|
|
26
|
-
return { ...client, airdrop: airdrop2 };
|
|
21
|
+
return {
|
|
22
|
+
...client,
|
|
23
|
+
airdrop: (address, amount, abortSignal) => airdropInternal({ abortSignal, commitment: "confirmed", lamports: amount, recipientAddress: address })
|
|
24
|
+
};
|
|
27
25
|
};
|
|
28
26
|
}
|
|
29
27
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["airdropFactory"],"mappings":";;;;;AAiDO,SAAS,OAAA,GAAU;AACtB,EAAA,OAAO,CAAsC,MAAA,KAAqC;AAC9E,IAAA,IAAI,SAAS,MAAA,EAAQ;AACjB,MAAA,OAAO;AAAA,QACH,GAAG,MAAA;AAAA,QACH,OAAA,EAAS,CAAC,OAAA,EAAS,MAAA,KAAW;AAC1B,UAAA,MAAA,CAAO,GAAA,CAAI,OAAA,CAAQ,OAAA,EAAS,MAAM,CAAA;AAClC,UAAA,OAAO,QAAQ,OAAA,EAAQ;AAAA,QAC3B;AAAA,OACJ;AAAA,IACJ;AACA,IAAA,MAAM,kBAAkBA,kBAAA,CAAe;AAAA,MACnC,KAAK,MAAA,CAAO,GAAA;AAAA,MACZ,kBAAkB,MAAA,CAAO;AAAA,KAC5B,CAAA;AACD,IAAA,OAAO;AAAA,MACH,GAAG,MAAA;AAAA,MACH,OAAA,EAAS,CAAC,OAAA,EAAS,MAAA,EAAQ,gBACvB,eAAA,CAAgB,EAAE,WAAA,EAAa,UAAA,EAAY,WAAA,EAAa,QAAA,EAAU,MAAA,EAAQ,gBAAA,EAAkB,SAAS;AAAA,KAC7G;AAAA,EACJ,CAAA;AACJ","file":"index.browser.cjs","sourcesContent":["import { Address, airdropFactory, ClientWithAirdrop, Lamports } from '@solana/kit';\n\ntype LiteSVMClient = {\n svm: { airdrop: (address: Address, lamports: Lamports) => unknown };\n};\ntype RpcClient = {\n rpc: Parameters<typeof airdropFactory>[0]['rpc'];\n rpcSubscriptions: Parameters<typeof airdropFactory>[0]['rpcSubscriptions'];\n};\n\n/**\n * A plugin that adds an `airdrop` method to the client.\n *\n * This will use the LiteSVM's internal airdrop method if the\n * client has LiteSVM installed. Otherwise, it will rely on the\n * `Rpc` and `RpcSubscriptions` clients to perform the airdrop.\n *\n * @example\n * RPC-based airdrop.\n * ```ts\n * import { createEmptyClient } from '@solana/kit';\n * import { airdrop, localhostRpc } from '@solana/kit-plugins';\n *\n * // Install the airdrop plugin using a localhost RPC.\n * const client = createEmptyClient()\n * .use(localhostRpc())\n * .use(airdrop());\n *\n * // Use the airdrop method.\n * client.airdrop(myAddress, lamports(1_000_000_000n));\n * ```\n *\n * @example\n * LiteSVM-based airdrop.\n * ```ts\n * import { createEmptyClient } from '@solana/kit';\n * import { airdrop, litesvm } from '@solana/kit-plugins';\n *\n * // Install the airdrop plugin using a LiteSVM instance.\n * const client = createEmptyClient()\n * .use(litesvm())\n * .use(airdrop());\n *\n * // Use the airdrop method.\n * client.airdrop(myAddress, lamports(1_000_000_000n));\n * ```\n *\n * @see {@link AirdropFunction}\n */\nexport function airdrop() {\n return <T extends LiteSVMClient | RpcClient>(client: T): ClientWithAirdrop & T => {\n if ('svm' in client) {\n return {\n ...client,\n airdrop: (address, amount) => {\n client.svm.airdrop(address, amount);\n return Promise.resolve();\n },\n } as ClientWithAirdrop & T;\n }\n const airdropInternal = airdropFactory({\n rpc: client.rpc,\n rpcSubscriptions: client.rpcSubscriptions,\n });\n return {\n ...client,\n airdrop: (address, amount, abortSignal) =>\n airdropInternal({ abortSignal, commitment: 'confirmed', lamports: amount, recipientAddress: address }),\n } as ClientWithAirdrop & T;\n };\n}\n"]}
|
package/dist/index.browser.mjs
CHANGED
|
@@ -4,24 +4,22 @@ import { airdropFactory } from '@solana/kit';
|
|
|
4
4
|
function airdrop() {
|
|
5
5
|
return (client) => {
|
|
6
6
|
if ("svm" in client) {
|
|
7
|
-
|
|
8
|
-
client
|
|
9
|
-
|
|
7
|
+
return {
|
|
8
|
+
...client,
|
|
9
|
+
airdrop: (address, amount) => {
|
|
10
|
+
client.svm.airdrop(address, amount);
|
|
11
|
+
return Promise.resolve();
|
|
12
|
+
}
|
|
10
13
|
};
|
|
11
|
-
return { ...client, airdrop: airdrop3 };
|
|
12
14
|
}
|
|
13
15
|
const airdropInternal = airdropFactory({
|
|
14
16
|
rpc: client.rpc,
|
|
15
17
|
rpcSubscriptions: client.rpcSubscriptions
|
|
16
18
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
commitment: "confirmed",
|
|
20
|
-
|
|
21
|
-
recipientAddress: address
|
|
22
|
-
}).then(() => {
|
|
23
|
-
});
|
|
24
|
-
return { ...client, airdrop: airdrop2 };
|
|
19
|
+
return {
|
|
20
|
+
...client,
|
|
21
|
+
airdrop: (address, amount, abortSignal) => airdropInternal({ abortSignal, commitment: "confirmed", lamports: amount, recipientAddress: address })
|
|
22
|
+
};
|
|
25
23
|
};
|
|
26
24
|
}
|
|
27
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAiDO,SAAS,OAAA,GAAU;AACtB,EAAA,OAAO,CAAsC,MAAA,KAAqC;AAC9E,IAAA,IAAI,SAAS,MAAA,EAAQ;AACjB,MAAA,OAAO;AAAA,QACH,GAAG,MAAA;AAAA,QACH,OAAA,EAAS,CAAC,OAAA,EAAS,MAAA,KAAW;AAC1B,UAAA,MAAA,CAAO,GAAA,CAAI,OAAA,CAAQ,OAAA,EAAS,MAAM,CAAA;AAClC,UAAA,OAAO,QAAQ,OAAA,EAAQ;AAAA,QAC3B;AAAA,OACJ;AAAA,IACJ;AACA,IAAA,MAAM,kBAAkB,cAAA,CAAe;AAAA,MACnC,KAAK,MAAA,CAAO,GAAA;AAAA,MACZ,kBAAkB,MAAA,CAAO;AAAA,KAC5B,CAAA;AACD,IAAA,OAAO;AAAA,MACH,GAAG,MAAA;AAAA,MACH,OAAA,EAAS,CAAC,OAAA,EAAS,MAAA,EAAQ,gBACvB,eAAA,CAAgB,EAAE,WAAA,EAAa,UAAA,EAAY,WAAA,EAAa,QAAA,EAAU,MAAA,EAAQ,gBAAA,EAAkB,SAAS;AAAA,KAC7G;AAAA,EACJ,CAAA;AACJ","file":"index.browser.mjs","sourcesContent":["import { Address, airdropFactory, ClientWithAirdrop, Lamports } from '@solana/kit';\n\ntype LiteSVMClient = {\n svm: { airdrop: (address: Address, lamports: Lamports) => unknown };\n};\ntype RpcClient = {\n rpc: Parameters<typeof airdropFactory>[0]['rpc'];\n rpcSubscriptions: Parameters<typeof airdropFactory>[0]['rpcSubscriptions'];\n};\n\n/**\n * A plugin that adds an `airdrop` method to the client.\n *\n * This will use the LiteSVM's internal airdrop method if the\n * client has LiteSVM installed. Otherwise, it will rely on the\n * `Rpc` and `RpcSubscriptions` clients to perform the airdrop.\n *\n * @example\n * RPC-based airdrop.\n * ```ts\n * import { createEmptyClient } from '@solana/kit';\n * import { airdrop, localhostRpc } from '@solana/kit-plugins';\n *\n * // Install the airdrop plugin using a localhost RPC.\n * const client = createEmptyClient()\n * .use(localhostRpc())\n * .use(airdrop());\n *\n * // Use the airdrop method.\n * client.airdrop(myAddress, lamports(1_000_000_000n));\n * ```\n *\n * @example\n * LiteSVM-based airdrop.\n * ```ts\n * import { createEmptyClient } from '@solana/kit';\n * import { airdrop, litesvm } from '@solana/kit-plugins';\n *\n * // Install the airdrop plugin using a LiteSVM instance.\n * const client = createEmptyClient()\n * .use(litesvm())\n * .use(airdrop());\n *\n * // Use the airdrop method.\n * client.airdrop(myAddress, lamports(1_000_000_000n));\n * ```\n *\n * @see {@link AirdropFunction}\n */\nexport function airdrop() {\n return <T extends LiteSVMClient | RpcClient>(client: T): ClientWithAirdrop & T => {\n if ('svm' in client) {\n return {\n ...client,\n airdrop: (address, amount) => {\n client.svm.airdrop(address, amount);\n return Promise.resolve();\n },\n } as ClientWithAirdrop & T;\n }\n const airdropInternal = airdropFactory({\n rpc: client.rpc,\n rpcSubscriptions: client.rpcSubscriptions,\n });\n return {\n ...client,\n airdrop: (address, amount, abortSignal) =>\n airdropInternal({ abortSignal, commitment: 'confirmed', lamports: amount, recipientAddress: address }),\n } as ClientWithAirdrop & T;\n };\n}\n"]}
|
package/dist/index.node.cjs
CHANGED
|
@@ -6,24 +6,22 @@ var kit = require('@solana/kit');
|
|
|
6
6
|
function airdrop() {
|
|
7
7
|
return (client) => {
|
|
8
8
|
if ("svm" in client) {
|
|
9
|
-
|
|
10
|
-
client
|
|
11
|
-
|
|
9
|
+
return {
|
|
10
|
+
...client,
|
|
11
|
+
airdrop: (address, amount) => {
|
|
12
|
+
client.svm.airdrop(address, amount);
|
|
13
|
+
return Promise.resolve();
|
|
14
|
+
}
|
|
12
15
|
};
|
|
13
|
-
return { ...client, airdrop: airdrop3 };
|
|
14
16
|
}
|
|
15
17
|
const airdropInternal = kit.airdropFactory({
|
|
16
18
|
rpc: client.rpc,
|
|
17
19
|
rpcSubscriptions: client.rpcSubscriptions
|
|
18
20
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
commitment: "confirmed",
|
|
22
|
-
|
|
23
|
-
recipientAddress: address
|
|
24
|
-
}).then(() => {
|
|
25
|
-
});
|
|
26
|
-
return { ...client, airdrop: airdrop2 };
|
|
21
|
+
return {
|
|
22
|
+
...client,
|
|
23
|
+
airdrop: (address, amount, abortSignal) => airdropInternal({ abortSignal, commitment: "confirmed", lamports: amount, recipientAddress: address })
|
|
24
|
+
};
|
|
27
25
|
};
|
|
28
26
|
}
|
|
29
27
|
|
package/dist/index.node.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["airdropFactory"],"mappings":";;;;;AAiDO,SAAS,OAAA,GAAU;AACtB,EAAA,OAAO,CAAsC,MAAA,KAAqC;AAC9E,IAAA,IAAI,SAAS,MAAA,EAAQ;AACjB,MAAA,OAAO;AAAA,QACH,GAAG,MAAA;AAAA,QACH,OAAA,EAAS,CAAC,OAAA,EAAS,MAAA,KAAW;AAC1B,UAAA,MAAA,CAAO,GAAA,CAAI,OAAA,CAAQ,OAAA,EAAS,MAAM,CAAA;AAClC,UAAA,OAAO,QAAQ,OAAA,EAAQ;AAAA,QAC3B;AAAA,OACJ;AAAA,IACJ;AACA,IAAA,MAAM,kBAAkBA,kBAAA,CAAe;AAAA,MACnC,KAAK,MAAA,CAAO,GAAA;AAAA,MACZ,kBAAkB,MAAA,CAAO;AAAA,KAC5B,CAAA;AACD,IAAA,OAAO;AAAA,MACH,GAAG,MAAA;AAAA,MACH,OAAA,EAAS,CAAC,OAAA,EAAS,MAAA,EAAQ,gBACvB,eAAA,CAAgB,EAAE,WAAA,EAAa,UAAA,EAAY,WAAA,EAAa,QAAA,EAAU,MAAA,EAAQ,gBAAA,EAAkB,SAAS;AAAA,KAC7G;AAAA,EACJ,CAAA;AACJ","file":"index.node.cjs","sourcesContent":["import { Address, airdropFactory, ClientWithAirdrop, Lamports } from '@solana/kit';\n\ntype LiteSVMClient = {\n svm: { airdrop: (address: Address, lamports: Lamports) => unknown };\n};\ntype RpcClient = {\n rpc: Parameters<typeof airdropFactory>[0]['rpc'];\n rpcSubscriptions: Parameters<typeof airdropFactory>[0]['rpcSubscriptions'];\n};\n\n/**\n * A plugin that adds an `airdrop` method to the client.\n *\n * This will use the LiteSVM's internal airdrop method if the\n * client has LiteSVM installed. Otherwise, it will rely on the\n * `Rpc` and `RpcSubscriptions` clients to perform the airdrop.\n *\n * @example\n * RPC-based airdrop.\n * ```ts\n * import { createEmptyClient } from '@solana/kit';\n * import { airdrop, localhostRpc } from '@solana/kit-plugins';\n *\n * // Install the airdrop plugin using a localhost RPC.\n * const client = createEmptyClient()\n * .use(localhostRpc())\n * .use(airdrop());\n *\n * // Use the airdrop method.\n * client.airdrop(myAddress, lamports(1_000_000_000n));\n * ```\n *\n * @example\n * LiteSVM-based airdrop.\n * ```ts\n * import { createEmptyClient } from '@solana/kit';\n * import { airdrop, litesvm } from '@solana/kit-plugins';\n *\n * // Install the airdrop plugin using a LiteSVM instance.\n * const client = createEmptyClient()\n * .use(litesvm())\n * .use(airdrop());\n *\n * // Use the airdrop method.\n * client.airdrop(myAddress, lamports(1_000_000_000n));\n * ```\n *\n * @see {@link AirdropFunction}\n */\nexport function airdrop() {\n return <T extends LiteSVMClient | RpcClient>(client: T): ClientWithAirdrop & T => {\n if ('svm' in client) {\n return {\n ...client,\n airdrop: (address, amount) => {\n client.svm.airdrop(address, amount);\n return Promise.resolve();\n },\n } as ClientWithAirdrop & T;\n }\n const airdropInternal = airdropFactory({\n rpc: client.rpc,\n rpcSubscriptions: client.rpcSubscriptions,\n });\n return {\n ...client,\n airdrop: (address, amount, abortSignal) =>\n airdropInternal({ abortSignal, commitment: 'confirmed', lamports: amount, recipientAddress: address }),\n } as ClientWithAirdrop & T;\n };\n}\n"]}
|
package/dist/index.node.mjs
CHANGED
|
@@ -4,24 +4,22 @@ import { airdropFactory } from '@solana/kit';
|
|
|
4
4
|
function airdrop() {
|
|
5
5
|
return (client) => {
|
|
6
6
|
if ("svm" in client) {
|
|
7
|
-
|
|
8
|
-
client
|
|
9
|
-
|
|
7
|
+
return {
|
|
8
|
+
...client,
|
|
9
|
+
airdrop: (address, amount) => {
|
|
10
|
+
client.svm.airdrop(address, amount);
|
|
11
|
+
return Promise.resolve();
|
|
12
|
+
}
|
|
10
13
|
};
|
|
11
|
-
return { ...client, airdrop: airdrop3 };
|
|
12
14
|
}
|
|
13
15
|
const airdropInternal = airdropFactory({
|
|
14
16
|
rpc: client.rpc,
|
|
15
17
|
rpcSubscriptions: client.rpcSubscriptions
|
|
16
18
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
commitment: "confirmed",
|
|
20
|
-
|
|
21
|
-
recipientAddress: address
|
|
22
|
-
}).then(() => {
|
|
23
|
-
});
|
|
24
|
-
return { ...client, airdrop: airdrop2 };
|
|
19
|
+
return {
|
|
20
|
+
...client,
|
|
21
|
+
airdrop: (address, amount, abortSignal) => airdropInternal({ abortSignal, commitment: "confirmed", lamports: amount, recipientAddress: address })
|
|
22
|
+
};
|
|
25
23
|
};
|
|
26
24
|
}
|
|
27
25
|
|
package/dist/index.node.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAiDO,SAAS,OAAA,GAAU;AACtB,EAAA,OAAO,CAAsC,MAAA,KAAqC;AAC9E,IAAA,IAAI,SAAS,MAAA,EAAQ;AACjB,MAAA,OAAO;AAAA,QACH,GAAG,MAAA;AAAA,QACH,OAAA,EAAS,CAAC,OAAA,EAAS,MAAA,KAAW;AAC1B,UAAA,MAAA,CAAO,GAAA,CAAI,OAAA,CAAQ,OAAA,EAAS,MAAM,CAAA;AAClC,UAAA,OAAO,QAAQ,OAAA,EAAQ;AAAA,QAC3B;AAAA,OACJ;AAAA,IACJ;AACA,IAAA,MAAM,kBAAkB,cAAA,CAAe;AAAA,MACnC,KAAK,MAAA,CAAO,GAAA;AAAA,MACZ,kBAAkB,MAAA,CAAO;AAAA,KAC5B,CAAA;AACD,IAAA,OAAO;AAAA,MACH,GAAG,MAAA;AAAA,MACH,OAAA,EAAS,CAAC,OAAA,EAAS,MAAA,EAAQ,gBACvB,eAAA,CAAgB,EAAE,WAAA,EAAa,UAAA,EAAY,WAAA,EAAa,QAAA,EAAU,MAAA,EAAQ,gBAAA,EAAkB,SAAS;AAAA,KAC7G;AAAA,EACJ,CAAA;AACJ","file":"index.node.mjs","sourcesContent":["import { Address, airdropFactory, ClientWithAirdrop, Lamports } from '@solana/kit';\n\ntype LiteSVMClient = {\n svm: { airdrop: (address: Address, lamports: Lamports) => unknown };\n};\ntype RpcClient = {\n rpc: Parameters<typeof airdropFactory>[0]['rpc'];\n rpcSubscriptions: Parameters<typeof airdropFactory>[0]['rpcSubscriptions'];\n};\n\n/**\n * A plugin that adds an `airdrop` method to the client.\n *\n * This will use the LiteSVM's internal airdrop method if the\n * client has LiteSVM installed. Otherwise, it will rely on the\n * `Rpc` and `RpcSubscriptions` clients to perform the airdrop.\n *\n * @example\n * RPC-based airdrop.\n * ```ts\n * import { createEmptyClient } from '@solana/kit';\n * import { airdrop, localhostRpc } from '@solana/kit-plugins';\n *\n * // Install the airdrop plugin using a localhost RPC.\n * const client = createEmptyClient()\n * .use(localhostRpc())\n * .use(airdrop());\n *\n * // Use the airdrop method.\n * client.airdrop(myAddress, lamports(1_000_000_000n));\n * ```\n *\n * @example\n * LiteSVM-based airdrop.\n * ```ts\n * import { createEmptyClient } from '@solana/kit';\n * import { airdrop, litesvm } from '@solana/kit-plugins';\n *\n * // Install the airdrop plugin using a LiteSVM instance.\n * const client = createEmptyClient()\n * .use(litesvm())\n * .use(airdrop());\n *\n * // Use the airdrop method.\n * client.airdrop(myAddress, lamports(1_000_000_000n));\n * ```\n *\n * @see {@link AirdropFunction}\n */\nexport function airdrop() {\n return <T extends LiteSVMClient | RpcClient>(client: T): ClientWithAirdrop & T => {\n if ('svm' in client) {\n return {\n ...client,\n airdrop: (address, amount) => {\n client.svm.airdrop(address, amount);\n return Promise.resolve();\n },\n } as ClientWithAirdrop & T;\n }\n const airdropInternal = airdropFactory({\n rpc: client.rpc,\n rpcSubscriptions: client.rpcSubscriptions,\n });\n return {\n ...client,\n airdrop: (address, amount, abortSignal) =>\n airdropInternal({ abortSignal, commitment: 'confirmed', lamports: amount, recipientAddress: address }),\n } as ClientWithAirdrop & T;\n };\n}\n"]}
|
|
@@ -4,24 +4,22 @@ import { airdropFactory } from '@solana/kit';
|
|
|
4
4
|
function airdrop() {
|
|
5
5
|
return (client) => {
|
|
6
6
|
if ("svm" in client) {
|
|
7
|
-
|
|
8
|
-
client
|
|
9
|
-
|
|
7
|
+
return {
|
|
8
|
+
...client,
|
|
9
|
+
airdrop: (address, amount) => {
|
|
10
|
+
client.svm.airdrop(address, amount);
|
|
11
|
+
return Promise.resolve();
|
|
12
|
+
}
|
|
10
13
|
};
|
|
11
|
-
return { ...client, airdrop: airdrop3 };
|
|
12
14
|
}
|
|
13
15
|
const airdropInternal = airdropFactory({
|
|
14
16
|
rpc: client.rpc,
|
|
15
17
|
rpcSubscriptions: client.rpcSubscriptions
|
|
16
18
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
commitment: "confirmed",
|
|
20
|
-
|
|
21
|
-
recipientAddress: address
|
|
22
|
-
}).then(() => {
|
|
23
|
-
});
|
|
24
|
-
return { ...client, airdrop: airdrop2 };
|
|
19
|
+
return {
|
|
20
|
+
...client,
|
|
21
|
+
airdrop: (address, amount, abortSignal) => airdropInternal({ abortSignal, commitment: "confirmed", lamports: amount, recipientAddress: address })
|
|
22
|
+
};
|
|
25
23
|
};
|
|
26
24
|
}
|
|
27
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAiDO,SAAS,OAAA,GAAU;AACtB,EAAA,OAAO,CAAsC,MAAA,KAAqC;AAC9E,IAAA,IAAI,SAAS,MAAA,EAAQ;AACjB,MAAA,OAAO;AAAA,QACH,GAAG,MAAA;AAAA,QACH,OAAA,EAAS,CAAC,OAAA,EAAS,MAAA,KAAW;AAC1B,UAAA,MAAA,CAAO,GAAA,CAAI,OAAA,CAAQ,OAAA,EAAS,MAAM,CAAA;AAClC,UAAA,OAAO,QAAQ,OAAA,EAAQ;AAAA,QAC3B;AAAA,OACJ;AAAA,IACJ;AACA,IAAA,MAAM,kBAAkB,cAAA,CAAe;AAAA,MACnC,KAAK,MAAA,CAAO,GAAA;AAAA,MACZ,kBAAkB,MAAA,CAAO;AAAA,KAC5B,CAAA;AACD,IAAA,OAAO;AAAA,MACH,GAAG,MAAA;AAAA,MACH,OAAA,EAAS,CAAC,OAAA,EAAS,MAAA,EAAQ,gBACvB,eAAA,CAAgB,EAAE,WAAA,EAAa,UAAA,EAAY,WAAA,EAAa,QAAA,EAAU,MAAA,EAAQ,gBAAA,EAAkB,SAAS;AAAA,KAC7G;AAAA,EACJ,CAAA;AACJ","file":"index.react-native.mjs","sourcesContent":["import { Address, airdropFactory, ClientWithAirdrop, Lamports } from '@solana/kit';\n\ntype LiteSVMClient = {\n svm: { airdrop: (address: Address, lamports: Lamports) => unknown };\n};\ntype RpcClient = {\n rpc: Parameters<typeof airdropFactory>[0]['rpc'];\n rpcSubscriptions: Parameters<typeof airdropFactory>[0]['rpcSubscriptions'];\n};\n\n/**\n * A plugin that adds an `airdrop` method to the client.\n *\n * This will use the LiteSVM's internal airdrop method if the\n * client has LiteSVM installed. Otherwise, it will rely on the\n * `Rpc` and `RpcSubscriptions` clients to perform the airdrop.\n *\n * @example\n * RPC-based airdrop.\n * ```ts\n * import { createEmptyClient } from '@solana/kit';\n * import { airdrop, localhostRpc } from '@solana/kit-plugins';\n *\n * // Install the airdrop plugin using a localhost RPC.\n * const client = createEmptyClient()\n * .use(localhostRpc())\n * .use(airdrop());\n *\n * // Use the airdrop method.\n * client.airdrop(myAddress, lamports(1_000_000_000n));\n * ```\n *\n * @example\n * LiteSVM-based airdrop.\n * ```ts\n * import { createEmptyClient } from '@solana/kit';\n * import { airdrop, litesvm } from '@solana/kit-plugins';\n *\n * // Install the airdrop plugin using a LiteSVM instance.\n * const client = createEmptyClient()\n * .use(litesvm())\n * .use(airdrop());\n *\n * // Use the airdrop method.\n * client.airdrop(myAddress, lamports(1_000_000_000n));\n * ```\n *\n * @see {@link AirdropFunction}\n */\nexport function airdrop() {\n return <T extends LiteSVMClient | RpcClient>(client: T): ClientWithAirdrop & T => {\n if ('svm' in client) {\n return {\n ...client,\n airdrop: (address, amount) => {\n client.svm.airdrop(address, amount);\n return Promise.resolve();\n },\n } as ClientWithAirdrop & T;\n }\n const airdropInternal = airdropFactory({\n rpc: client.rpc,\n rpcSubscriptions: client.rpcSubscriptions,\n });\n return {\n ...client,\n airdrop: (address, amount, abortSignal) =>\n airdropInternal({ abortSignal, commitment: 'confirmed', lamports: amount, recipientAddress: address }),\n } as ClientWithAirdrop & T;\n };\n}\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, airdropFactory, Lamports } from '@solana/kit';
|
|
1
|
+
import { Address, airdropFactory, ClientWithAirdrop, Lamports } from '@solana/kit';
|
|
2
2
|
type LiteSVMClient = {
|
|
3
3
|
svm: {
|
|
4
4
|
airdrop: (address: Address, lamports: Lamports) => unknown;
|
|
@@ -8,14 +8,6 @@ type RpcClient = {
|
|
|
8
8
|
rpc: Parameters<typeof airdropFactory>[0]['rpc'];
|
|
9
9
|
rpcSubscriptions: Parameters<typeof airdropFactory>[0]['rpcSubscriptions'];
|
|
10
10
|
};
|
|
11
|
-
/**
|
|
12
|
-
* Function type for the `airdrop` method added to the client.
|
|
13
|
-
*
|
|
14
|
-
* @param address - The address to which the airdrop will be sent.
|
|
15
|
-
* @param amount - The amount of lamports to airdrop.
|
|
16
|
-
* @param abortSignal - Optional signal to abort the airdrop operation.
|
|
17
|
-
*/
|
|
18
|
-
export type AirdropFunction = (address: Address, amount: Lamports, abortSignal?: AbortSignal) => Promise<void>;
|
|
19
11
|
/**
|
|
20
12
|
* A plugin that adds an `airdrop` method to the client.
|
|
21
13
|
*
|
|
@@ -55,8 +47,6 @@ export type AirdropFunction = (address: Address, amount: Lamports, abortSignal?:
|
|
|
55
47
|
*
|
|
56
48
|
* @see {@link AirdropFunction}
|
|
57
49
|
*/
|
|
58
|
-
export declare function airdrop(): <T extends LiteSVMClient | RpcClient>(client: T) =>
|
|
59
|
-
airdrop: AirdropFunction;
|
|
60
|
-
};
|
|
50
|
+
export declare function airdrop(): <T extends LiteSVMClient | RpcClient>(client: T) => ClientWithAirdrop & T;
|
|
61
51
|
export {};
|
|
62
52
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEnF,KAAK,aAAa,GAAG;IACjB,GAAG,EAAE;QAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAA;KAAE,CAAC;CACvE,CAAC;AACF,KAAK,SAAS,GAAG;IACb,GAAG,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACjD,gBAAgB,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;CAC9E,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,OAAO,KACX,CAAC,SAAS,aAAa,GAAG,SAAS,EAAE,QAAQ,CAAC,KAAG,iBAAiB,GAAG,CAAC,CAoBjF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/kit-plugin-airdrop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Airdrop helpers for Kit clients",
|
|
5
5
|
"exports": {
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"airdrop"
|
|
36
36
|
],
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@solana/kit": "^6.
|
|
38
|
+
"@solana/kit": "^6.1.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@solana/kit-plugin-
|
|
42
|
-
"@solana/kit-plugin-
|
|
41
|
+
"@solana/kit-plugin-rpc": "0.3.0",
|
|
42
|
+
"@solana/kit-plugin-litesvm": "0.3.1"
|
|
43
43
|
},
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"repository": {
|