swig-developer-sdk 0.6.0__tar.gz

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.
@@ -0,0 +1,164 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ lerna-debug.log*
8
+ .pnpm-debug.log*
9
+
10
+ # Diagnostic reports (https://nodejs.org/api/report.html)
11
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12
+
13
+ # Runtime data
14
+ pids
15
+ *.pid
16
+ *.seed
17
+ *.pid.lock
18
+
19
+ # Directory for instrumented libs generated by jscoverage/JSCover
20
+ lib-cov
21
+
22
+ # Coverage directory used by tools like istanbul
23
+ coverage
24
+ *.lcov
25
+
26
+ # nyc test coverage
27
+ .nyc_output
28
+
29
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30
+ .grunt
31
+
32
+ # Bower dependency directory (https://bower.io/)
33
+ bower_components
34
+
35
+ # node-waf configuration
36
+ .lock-wscript
37
+
38
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
39
+ build/Release
40
+
41
+ # Dependency directories
42
+ node_modules/
43
+ jspm_packages/
44
+
45
+ # Snowpack dependency directory (https://snowpack.dev/)
46
+ web_modules/
47
+
48
+ # TypeScript cache
49
+ *.tsbuildinfo
50
+
51
+ # Optional npm cache directory
52
+ .npm
53
+
54
+ # Optional eslint cache
55
+ .eslintcache
56
+
57
+ # Optional stylelint cache
58
+ .stylelintcache
59
+
60
+ # Microbundle cache
61
+ .rpt2_cache/
62
+ .rts2_cache_cjs/
63
+ .rts2_cache_es/
64
+ .rts2_cache_umd/
65
+
66
+ # Optional REPL history
67
+ .node_repl_history
68
+
69
+ # Output of 'npm pack'
70
+ *.tgz
71
+
72
+ # Yarn Integrity file
73
+ .yarn-integrity
74
+
75
+ # dotenv environment variable files
76
+ .env
77
+ .env.development.local
78
+ .env.test.local
79
+ .env.production.local
80
+ .env.local
81
+
82
+ # parcel-bundler cache (https://parceljs.org/)
83
+ .cache
84
+ .parcel-cache
85
+
86
+ # Next.js build output
87
+ .next
88
+ out
89
+
90
+ # Nuxt.js build / generate output
91
+ .nuxt
92
+ dist
93
+
94
+ # Gatsby files
95
+ .cache/
96
+ # Comment in the public line in if your project uses Gatsby and not Next.js
97
+ # https://nextjs.org/blog/next-9-1#public-directory-support
98
+ # public
99
+
100
+ # vuepress build output
101
+ .vuepress/dist
102
+
103
+ # vuepress v2.x temp and cache directory
104
+ .temp
105
+ .cache
106
+
107
+ # vitepress build output
108
+ **/.vitepress/dist
109
+
110
+ # vitepress cache directory
111
+ **/.vitepress/cache
112
+
113
+ # Docusaurus cache and generated files
114
+ .docusaurus
115
+
116
+ # Serverless directories
117
+ .serverless/
118
+
119
+ # FuseBox cache
120
+ .fusebox/
121
+
122
+ # DynamoDB Local files
123
+ .dynamodb/
124
+
125
+ # TernJS port file
126
+ .tern-port
127
+
128
+ # Stores VSCode versions used for testing VSCode extensions
129
+ .vscode-test
130
+
131
+ # yarn v2
132
+ .yarn/cache
133
+ .yarn/unplugged
134
+ .yarn/build-state.yml
135
+ .yarn/install-state.gz
136
+ .pnp.*
137
+
138
+ # Mac OS shenanigans
139
+ .DS_Store
140
+
141
+ # Rust
142
+ target
143
+
144
+ # Solana
145
+ test-ledger
146
+
147
+ docs
148
+
149
+ swig-program
150
+ swig.so
151
+ .nx/cache
152
+ .nx/workspace-data
153
+ .cursor/rules/nx-rules.mdc
154
+ .github/instructions/nx.instructions.md
155
+ *.so
156
+
157
+ # Python
158
+ __pycache__/
159
+ *.py[cod]
160
+ .mypy_cache/
161
+ .pytest_cache/
162
+ .ruff_cache/
163
+ .venv/
164
+ *.egg-info/
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: swig-developer-sdk
3
+ Version: 0.6.0
4
+ Summary: Python SDK for preparing and locally signing Swig wallet transactions
5
+ Project-URL: Repository, https://github.com/anagrambuild/swig-ts
6
+ Author: Anagram
7
+ License: Apache-2.0
8
+ Requires-Python: >=3.10
9
+ Requires-Dist: base58<3,>=2.1
10
+ Requires-Dist: httpx<1,>=0.28
11
+ Requires-Dist: solders<0.29,>=0.28
12
+ Description-Content-Type: text/markdown
13
+
14
+ # Swig Developer SDK for Python
15
+
16
+ Python parity for `@swig-wallet/developer-sdk`. The Swig API prepares wallet
17
+ transactions; this SDK invokes application-owned signers and inserts signatures
18
+ locally with `solders`.
19
+
20
+ ```bash
21
+ pip install swig-developer-sdk
22
+ ```
23
+
24
+ ## Prepare a transaction
25
+
26
+ ```python
27
+ from swig_developer_sdk import SwigClient
28
+
29
+ swig = SwigClient(api_key="swig_...", network="devnet")
30
+ wallet = swig.wallets.use(
31
+ "SWIG_CONFIG_ADDRESS",
32
+ requester_authority={"ed25519": {"publicKey": "USER_PUBLIC_KEY"}},
33
+ )
34
+
35
+ prepared = await wallet.transfer.sol(
36
+ fee_payer="FEE_PAYER",
37
+ destination="DESTINATION",
38
+ amount=1_000_000,
39
+ )
40
+ ```
41
+
42
+ `wallet.transfer(...)` and `wallet.swap(...)` are callable like their
43
+ TypeScript counterparts. Their explicit `sol`, `token`, `spl_token`, and
44
+ `jupiter` methods are available as well.
45
+
46
+ ## Sign locally
47
+
48
+ The generic signer helper works with an application-owned Ed25519 signer. The
49
+ Swig signer helper patches secp256r1 or secp256k1 signatures into both legacy
50
+ and versioned Solana transactions without sending signing material to the API.
51
+
52
+ ```python
53
+ from swig_developer_sdk import sign_prepared_swig_transaction
54
+
55
+ signed = await sign_prepared_swig_transaction(
56
+ prepared,
57
+ secp256r1=application_passkey_signer,
58
+ )
59
+ ```
60
+
61
+ WebAuthn and EIP-1193 adapters are callback-based so applications can connect
62
+ their browser, hardware, wallet, or remote signer without changing the
63
+ transaction preparation API.
64
+
65
+ ## Local end-to-end test
66
+
67
+ With the `swig-dev-portal` Tilt stack running, this command seeds a temporary
68
+ local API key and exercises wallet creation, real P-256 signing, direct and
69
+ grouped SOL transfers, an SPL-token transfer, and the Python proxy through the
70
+ Developer API. It also verifies the live paymaster balance endpoint and a
71
+ sponsored transfer where the user pays no network fee. Every transaction is
72
+ submitted to Surfpool and verified on-chain; the paymaster flow also retries
73
+ with the same idempotency key and verifies that no balance changes repeat.
74
+
75
+ ```bash
76
+ bun run e2e:developer-sdk:python
77
+ ```
78
+
79
+ The defaults are `http://localhost:8080` for the Developer API,
80
+ `http://localhost:8899` for Surfpool, and the Tilt Postgres instance on port
81
+ `55432`. Override them with `SWIG_TRANSACTION_API_URL`, `SOLANA_RPC_URL`, or
82
+ `SWIG_DATABASE_URL`.
83
+
84
+ Jupiter and recovery are not counted by this local test: Jupiter needs a
85
+ mainnet-backed Surfpool, while recovery setup needs a reachable operator
86
+ signer.
87
+
88
+ See the repository-level [parity matrix](../PARITY.md) for the complete mapped
89
+ surface.
@@ -0,0 +1,76 @@
1
+ # Swig Developer SDK for Python
2
+
3
+ Python parity for `@swig-wallet/developer-sdk`. The Swig API prepares wallet
4
+ transactions; this SDK invokes application-owned signers and inserts signatures
5
+ locally with `solders`.
6
+
7
+ ```bash
8
+ pip install swig-developer-sdk
9
+ ```
10
+
11
+ ## Prepare a transaction
12
+
13
+ ```python
14
+ from swig_developer_sdk import SwigClient
15
+
16
+ swig = SwigClient(api_key="swig_...", network="devnet")
17
+ wallet = swig.wallets.use(
18
+ "SWIG_CONFIG_ADDRESS",
19
+ requester_authority={"ed25519": {"publicKey": "USER_PUBLIC_KEY"}},
20
+ )
21
+
22
+ prepared = await wallet.transfer.sol(
23
+ fee_payer="FEE_PAYER",
24
+ destination="DESTINATION",
25
+ amount=1_000_000,
26
+ )
27
+ ```
28
+
29
+ `wallet.transfer(...)` and `wallet.swap(...)` are callable like their
30
+ TypeScript counterparts. Their explicit `sol`, `token`, `spl_token`, and
31
+ `jupiter` methods are available as well.
32
+
33
+ ## Sign locally
34
+
35
+ The generic signer helper works with an application-owned Ed25519 signer. The
36
+ Swig signer helper patches secp256r1 or secp256k1 signatures into both legacy
37
+ and versioned Solana transactions without sending signing material to the API.
38
+
39
+ ```python
40
+ from swig_developer_sdk import sign_prepared_swig_transaction
41
+
42
+ signed = await sign_prepared_swig_transaction(
43
+ prepared,
44
+ secp256r1=application_passkey_signer,
45
+ )
46
+ ```
47
+
48
+ WebAuthn and EIP-1193 adapters are callback-based so applications can connect
49
+ their browser, hardware, wallet, or remote signer without changing the
50
+ transaction preparation API.
51
+
52
+ ## Local end-to-end test
53
+
54
+ With the `swig-dev-portal` Tilt stack running, this command seeds a temporary
55
+ local API key and exercises wallet creation, real P-256 signing, direct and
56
+ grouped SOL transfers, an SPL-token transfer, and the Python proxy through the
57
+ Developer API. It also verifies the live paymaster balance endpoint and a
58
+ sponsored transfer where the user pays no network fee. Every transaction is
59
+ submitted to Surfpool and verified on-chain; the paymaster flow also retries
60
+ with the same idempotency key and verifies that no balance changes repeat.
61
+
62
+ ```bash
63
+ bun run e2e:developer-sdk:python
64
+ ```
65
+
66
+ The defaults are `http://localhost:8080` for the Developer API,
67
+ `http://localhost:8899` for Surfpool, and the Tilt Postgres instance on port
68
+ `55432`. Override them with `SWIG_TRANSACTION_API_URL`, `SOLANA_RPC_URL`, or
69
+ `SWIG_DATABASE_URL`.
70
+
71
+ Jupiter and recovery are not counted by this local test: Jupiter needs a
72
+ mainnet-backed Surfpool, while recovery setup needs a reachable operator
73
+ signer.
74
+
75
+ See the repository-level [parity matrix](../PARITY.md) for the complete mapped
76
+ surface.
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "swig-developer-sdk"
7
+ version = "0.6.0"
8
+ description = "Python SDK for preparing and locally signing Swig wallet transactions"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [{ name = "Anagram" }]
13
+ dependencies = [
14
+ "base58>=2.1,<3",
15
+ "httpx>=0.28,<1",
16
+ "solders>=0.28,<0.29",
17
+ ]
18
+
19
+ [project.urls]
20
+ Repository = "https://github.com/anagrambuild/swig-ts"
21
+
22
+ [dependency-groups]
23
+ dev = [
24
+ "cryptography>=49.0.0",
25
+ "mypy>=1.16,<2",
26
+ "pytest>=8.4,<9",
27
+ "pytest-asyncio>=1.0,<2",
28
+ "ruff>=0.12,<1",
29
+ ]
30
+
31
+ [tool.hatch.build.targets.wheel]
32
+ packages = ["src/swig_developer_sdk"]
33
+
34
+ [tool.pytest.ini_options]
35
+ asyncio_mode = "auto"
36
+ testpaths = ["tests"]
37
+
38
+ [tool.ruff]
39
+ line-length = 88
40
+ target-version = "py310"
41
+
42
+ [tool.ruff.lint]
43
+ select = ["E", "F", "I", "UP", "B", "SIM", "RUF"]
44
+
45
+ [tool.mypy]
46
+ python_version = "3.10"
47
+ strict = true
48
+ packages = ["swig_developer_sdk"]
49
+ mypy_path = "src"