@armory-sh/base 0.2.22-alpha.3.23 → 0.2.23-alpha.10.37

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.
Files changed (3) hide show
  1. package/README.md +155 -12
  2. package/dist/index.js +4 -4
  3. package/package.json +17 -1
package/README.md CHANGED
@@ -1,28 +1,171 @@
1
1
  # @armory-sh/base
2
2
 
3
- Core types and utilities for Armory payment protocol.
3
+ Armory x402 SDK — Core protocol types, EIP-712 signing, encoding, network configs, and token registry. 100% compatible with Coinbase x402 SDKs.
4
4
 
5
- ## Install
5
+ [Documentation](https://armory.sh) | [License](LICENSE)
6
+
7
+ ## Installation
6
8
 
7
9
  ```bash
8
10
  bun add @armory-sh/base
9
11
  ```
10
12
 
11
- ## Use
13
+ ## Why Armory?
14
+
15
+ Armory enables HTTP API payments via EIP-3009 `transferWithAuthorization`. Let your users pay with USDC directly from their wallet—no credit cards, no middlemen, no gas for payers.
16
+
17
+ ## Key Exports
12
18
 
13
19
  ```typescript
14
- import type { PaymentRequest, PaymentResponse } from '@armory-sh/base'
15
- import { calculateExpiry } from '@armory-sh/base'
20
+ import {
21
+ // Types
22
+ type PaymentPayload,
23
+ type PaymentPayloadV2,
24
+ type PaymentRequirementsV2,
25
+ type SettlementResponseV2,
26
+ type CustomToken,
27
+ type NetworkConfig,
28
+
29
+ // Encoding/Decoding
30
+ encodePaymentV2,
31
+ decodePaymentV2,
32
+ encodeSettlementV2,
33
+ decodeSettlementV2,
34
+ safeBase64Encode,
35
+ safeBase64Decode,
36
+
37
+ // EIP-712
38
+ createEIP712Domain,
39
+ createTransferWithAuthorization,
40
+ validateTransferWithAuthorization,
41
+ EIP712_TYPES,
42
+
43
+ // Networks
44
+ NETWORKS,
45
+ getNetworkConfig,
46
+ getNetworkByChainId,
47
+ getMainnets,
48
+ getTestnets,
49
+
50
+ // Token Registry
51
+ TOKENS,
52
+ registerToken,
53
+ getCustomToken,
54
+ getAllCustomTokens,
55
+ unregisterToken,
56
+ isCustomToken,
57
+
58
+ // Utilities
59
+ createNonce,
60
+ toAtomicUnits,
61
+ fromAtomicUnits,
62
+ resolveNetwork,
63
+ resolveToken,
64
+ } from '@armory-sh/base';
65
+ ```
66
+
67
+ ## Quick Start
68
+
69
+ ### Pre-configured Tokens
70
+
71
+ ```typescript
72
+ import { TOKENS } from '@armory-sh/base'
73
+
74
+ const usdc = TOKENS.USDC_BASE
75
+ console.log(usdc)
76
+ // {
77
+ // symbol: 'USDC',
78
+ // name: 'USD Coin',
79
+ // contractAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
80
+ // chainId: 8453,
81
+ // decimals: 6
82
+ // }
83
+ ```
84
+
85
+ ### Create EIP-712 Domain
86
+
87
+ ```typescript
88
+ import { createEIP712Domain } from '@armory-sh/base'
89
+
90
+ const domain = createEIP712Domain({
91
+ verifyingContract: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
92
+ chainId: 8453
93
+ })
94
+ ```
95
+
96
+ ### Generate Nonce
16
97
 
17
- const payment: PaymentRequest = {
18
- to: '0x...',
19
- amount: 1000000n,
20
- expiry: calculateExpiry(3600),
98
+ ```typescript
99
+ import { createNonce } from '@armory-sh/base'
100
+
101
+ const nonce = createNonce()
102
+ // '0x0000000000000000000000000000000000000000000000000000000000000001'
103
+ ```
104
+
105
+ ### Register Custom Token
106
+
107
+ ```typescript
108
+ import { registerToken, type CustomToken } from '@armory-sh/base'
109
+
110
+ const myToken: CustomToken = {
111
+ symbol: 'MYTOKEN',
112
+ name: 'My Custom Token',
113
+ version: '1',
114
+ contractAddress: '0x...',
115
+ chainId: 8453,
116
+ decimals: 18,
117
+ }
118
+
119
+ registerToken(myToken)
120
+ ```
121
+
122
+ ### Encode/Decode Payment
123
+
124
+ ```typescript
125
+ import { encodePaymentV2, decodePaymentV2 } from '@armory-sh/base'
126
+
127
+ const payload = {
21
128
  chainId: 'eip155:8453',
22
- assetId: 'eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
129
+ assetId: 'eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
130
+ payTo: '0x...',
131
+ signature: {
132
+ from: '0x...',
133
+ to: '0x...',
134
+ value: '1000000',
135
+ validAfter: '0',
136
+ validBefore: '1736899200',
137
+ nonce: '0x0000000000000000000000000000000000000000000000000000000000000001',
138
+ signature: { r: '0x...', s: '0x...', v: 28 }
139
+ }
23
140
  }
141
+
142
+ // Encode for HTTP header
143
+ const encoded = encodePaymentV2(payload)
144
+
145
+ // Decode from HTTP header
146
+ const decoded = decodePaymentV2(encoded)
24
147
  ```
25
148
 
26
- ---
149
+ ## Features
150
+
151
+ - **x402 v2 Protocol**: Full compatibility with Coinbase x402 SDKs
152
+ - **EIP-3009 / EIP-712**: Typed data signing for secure off-chain payments
153
+ - **Network Registry**: Ethereum, Base, SKALE — mainnets and testnets
154
+ - **Token Registry**: USDC, EURC, USDT, WBTC, WETH, SKL
155
+ - **Custom Tokens**: Register your own tokens
156
+ - **Encoding**: Base64URL encoding for HTTP headers
157
+
158
+ ## Supported Networks
159
+
160
+ | Network | Chain ID |
161
+ |---------|----------|
162
+ | Ethereum | 1 |
163
+ | Base | 8453 |
164
+ | Base Sepolia | 84532 |
165
+ | SKALE Base | 1187947933 |
166
+ | SKALE Base Sepolia | 324705682 |
167
+ | Ethereum Sepolia | 11155111 |
168
+
169
+ ## License
27
170
 
28
- MIT License | Sawyer Cutler 2026 | Provided "AS IS" without warranty
171
+ MIT © [Sawyer Cutler](https://github.com/TheGreatAxios/armory)
package/dist/index.js CHANGED
@@ -350,7 +350,7 @@ var isCustomToken = (chainId, contractAddress) => tokenRegistry.has(tokenKey(cha
350
350
  // src/data/tokens.ts
351
351
  var USDC_BASE = {
352
352
  symbol: "USDC",
353
- name: "USD Coin",
353
+ name: "USDC",
354
354
  version: "2",
355
355
  contractAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
356
356
  chainId: 8453,
@@ -366,7 +366,7 @@ var EURC_BASE = {
366
366
  };
367
367
  var USDC_BASE_SEPOLIA = {
368
368
  symbol: "USDC",
369
- name: "USD Coin",
369
+ name: "USDC",
370
370
  version: "2",
371
371
  contractAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
372
372
  chainId: 84532,
@@ -374,7 +374,7 @@ var USDC_BASE_SEPOLIA = {
374
374
  };
375
375
  var USDC_SKALE_BASE = {
376
376
  symbol: "USDC",
377
- name: "USD Coin",
377
+ name: "Bridged USDC (SKALE Bridge)",
378
378
  version: "2",
379
379
  contractAddress: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20",
380
380
  chainId: 1187947933,
@@ -422,7 +422,7 @@ var SKL_SKALE_BASE_SEPOLIA = {
422
422
  };
423
423
  var USDC_SKALE_BASE_SEPOLIA = {
424
424
  symbol: "USDC",
425
- name: "USD Coin",
425
+ name: "Bridged USDC (SKALE Bridge)",
426
426
  version: "2",
427
427
  contractAddress: "0x2e08028E3C4c2356572E096d8EF835cD5C6030bD",
428
428
  chainId: 324705682,
package/package.json CHANGED
@@ -1,8 +1,24 @@
1
1
  {
2
2
  "name": "@armory-sh/base",
3
- "version": "0.2.22-alpha.3.23",
3
+ "version": "0.2.23-alpha.10.37",
4
4
  "license": "MIT",
5
5
  "author": "Sawyer Cutler <sawyer@dirtroad.dev>",
6
+ "keywords": [
7
+ "x402",
8
+ "ai",
9
+ "agentic commerce",
10
+ "ai agent",
11
+ "stablecoins",
12
+ "eip-3009",
13
+ "skale",
14
+ "base",
15
+ "machine economy",
16
+ "payment",
17
+ "crypto",
18
+ "web3",
19
+ "ethereum",
20
+ "usdc"
21
+ ],
6
22
  "type": "module",
7
23
  "main": "./dist/index.js",
8
24
  "types": "./dist/index.d.ts",