@payagent/wdk-protocol 0.1.0 → 0.1.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/LICENSE +21 -0
- package/README.md +30 -15
- package/package.json +11 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PayAgent / LCX AI Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
PayAgent protocol for Tether WDK. **Not a wallet.** You pass a WDK `WalletAccount`. This package never sees a seed.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```bash
|
|
6
|
+
npm install @payagent/wdk-protocol @tetherto/wdk @tetherto/wdk-wallet-solana
|
|
7
|
+
```
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Use `@tetherto/wdk-wallet-evm` instead of the Solana module for Ethereum, Base, or Sepolia. Then register the agent over the PayAgent API and attach the WDK address. `npm install` does not register anything.
|
|
10
|
+
|
|
11
|
+
v1: `preflight` + `pay` for a payment link, profile, or address. USDT/USDC (and catalog natives) on Ethereum, Base, Solana.
|
|
8
12
|
|
|
9
13
|
```ts
|
|
10
14
|
import { PayAgentProtocol } from "@payagent/wdk-protocol";
|
|
@@ -13,29 +17,40 @@ const protocol = new PayAgentProtocol(account, {
|
|
|
13
17
|
baseUrl: "https://www.payagent.co",
|
|
14
18
|
apiKey: process.env.PAYAGENT_API_KEY!,
|
|
15
19
|
agentId: "your-agent-id",
|
|
16
|
-
networkId: "
|
|
20
|
+
networkId: "solana",
|
|
17
21
|
});
|
|
18
22
|
|
|
19
23
|
const result = await protocol.pay({
|
|
20
|
-
type: "
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
type: "address",
|
|
25
|
+
recipientAddress: "…",
|
|
26
|
+
amount: 1,
|
|
27
|
+
tokenId: "usdt",
|
|
28
|
+
networkId: "solana",
|
|
23
29
|
});
|
|
24
30
|
```
|
|
25
31
|
|
|
26
32
|
If `pay` throws `RecordFailedError`, the transfer already landed. Call `protocol.record(...)` with the same `txHash` and `idempotencyKey`. Do not transfer again.
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
Settlement is the verified on-chain `txHash`. PayAgent does not hold keys and is not a paymaster — the WDK wallet pays SOL or ETH for gas.
|
|
35
|
+
|
|
36
|
+
Runnable two-agent Solana USDT template: [wdk-tether-test-agent](https://github.com/Mrinallcx/wdk-tether-test-agent). Docs: [payagent.co/docs](https://www.payagent.co/docs#wdk-protocol).
|
|
37
|
+
|
|
38
|
+
## Tests
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install
|
|
42
|
+
npm test
|
|
43
|
+
```
|
|
29
44
|
|
|
30
|
-
|
|
45
|
+
## Staging script (real WDK)
|
|
31
46
|
|
|
32
47
|
```bash
|
|
33
|
-
cp
|
|
34
|
-
# fill seed,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
WDK_STAGING_SEND=1
|
|
48
|
+
cp env.example .env
|
|
49
|
+
# fill seed, API key, agent id, USDT link
|
|
50
|
+
npm run staging:address
|
|
51
|
+
npm run staging:attach
|
|
52
|
+
npm run staging:preflight
|
|
53
|
+
WDK_STAGING_SEND=1 npm run staging:pay
|
|
39
54
|
```
|
|
40
55
|
|
|
41
|
-
`pay` will not broadcast unless both `--send` and `WDK_STAGING_SEND=1` are set. Use a no-approval USDT policy
|
|
56
|
+
`pay` will not broadcast unless both `--send` and `WDK_STAGING_SEND=1` are set. Use a no-approval USDT policy. Do not use a production treasury seed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payagent/wdk-protocol",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "WDK protocol module for PayAgent. Stateless. Takes a WalletAccount. Never holds keys.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
-
"README.md"
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
17
18
|
],
|
|
18
19
|
"scripts": {
|
|
19
20
|
"build": "tsc -p tsconfig.json",
|
|
@@ -36,13 +37,16 @@
|
|
|
36
37
|
"usdt"
|
|
37
38
|
],
|
|
38
39
|
"license": "MIT",
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"access": "public"
|
|
41
|
-
},
|
|
42
40
|
"repository": {
|
|
43
41
|
"type": "git",
|
|
44
|
-
"url": "git+https://github.com/Mrinallcx/
|
|
45
|
-
|
|
42
|
+
"url": "git+https://github.com/Mrinallcx/wdk-protocol.git"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/Mrinallcx/wdk-protocol",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/Mrinallcx/wdk-protocol/issues"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
46
50
|
},
|
|
47
51
|
"engines": {
|
|
48
52
|
"node": ">=18"
|