199 lines
4.0 KiB
Markdown
199 lines
4.0 KiB
Markdown
# Secret System API Examples (v1)
|
|
|
|
## 1) `POST /secret/wallet/intent`
|
|
|
|
Request:
|
|
|
|
```json
|
|
{
|
|
"address": "0x3ea6cbf98d23e2cf7b6f4f9bb1fb4f50b710f2d5",
|
|
"origin": "https://edut.ai",
|
|
"locale": "en",
|
|
"chain_id": 8453
|
|
}
|
|
```
|
|
|
|
Success (`200`):
|
|
|
|
```json
|
|
{
|
|
"intent_id": "wi_01HZZX2Q8R0FQFQ6B1VQ1N2P9J",
|
|
"designation_code": "0217073045482",
|
|
"display_token": "0217-0730-4548-2",
|
|
"nonce": "47f43f70d1288d4e",
|
|
"issued_at": "2026-02-17T07:30:45Z",
|
|
"expires_at": "2026-02-17T07:35:45Z",
|
|
"domain_name": "EDUT Designation",
|
|
"chain_id": 8453,
|
|
"verifying_contract": "0x0000000000000000000000000000000000000000"
|
|
}
|
|
```
|
|
|
|
Error (`429` rate limited):
|
|
|
|
```json
|
|
{
|
|
"error": "Too many intent requests. Retry later.",
|
|
"code": "rate_limited",
|
|
"correlation_id": "req_3f5b42e0f1a9e8c1"
|
|
}
|
|
```
|
|
|
|
## 2) `POST /secret/wallet/verify`
|
|
|
|
Request:
|
|
|
|
```json
|
|
{
|
|
"intent_id": "wi_01HZZX2Q8R0FQFQ6B1VQ1N2P9J",
|
|
"address": "0x3ea6cbf98d23e2cf7b6f4f9bb1fb4f50b710f2d5",
|
|
"chain_id": 8453,
|
|
"signature": "0xabcdef..."
|
|
}
|
|
```
|
|
|
|
Success (`200`):
|
|
|
|
```json
|
|
{
|
|
"status": "signature_verified",
|
|
"designation_code": "0217073045482",
|
|
"display_token": "0217-0730-4548-2",
|
|
"verified_at": "2026-02-17T07:31:12Z"
|
|
}
|
|
```
|
|
|
|
Error (`400` intent expired):
|
|
|
|
```json
|
|
{
|
|
"error": "Intent has expired. Request a new intent.",
|
|
"code": "intent_expired",
|
|
"correlation_id": "req_8e7e75da2fcb9bd0"
|
|
}
|
|
```
|
|
|
|
## 3) `POST /secret/membership/quote`
|
|
|
|
Request:
|
|
|
|
```json
|
|
{
|
|
"designation_code": "0217073045482",
|
|
"address": "0x3ea6cbf98d23e2cf7b6f4f9bb1fb4f50b710f2d5",
|
|
"chain_id": 8453,
|
|
"payer_wallet": "0x2299547f6fA9A8f9b6d9aEA9F9D8A4B53C8A0e11",
|
|
"payer_proof": "0xowner-signed-proof",
|
|
"sponsor_org_root_id": "org_company_a"
|
|
}
|
|
```
|
|
|
|
Success (`200`):
|
|
|
|
```json
|
|
{
|
|
"quote_id": "mq_01HZZX4F8VQXJ6A57R8P3SCB2W",
|
|
"chain_id": 8453,
|
|
"currency": "USDC",
|
|
"amount": "100.00",
|
|
"amount_atomic": "100000000",
|
|
"decimals": 6,
|
|
"deadline": "2026-02-17T07:36:12Z",
|
|
"contract_address": "0x1111111111111111111111111111111111111111",
|
|
"method": "mintMembership",
|
|
"calldata": "0xdeadbeef",
|
|
"value": "0x0",
|
|
"owner_wallet": "0x3ea6cbf98d23e2cf7b6f4f9bb1fb4f50b710f2d5",
|
|
"payer_wallet": "0x2299547f6fA9A8f9b6d9aEA9F9D8A4B53C8A0e11",
|
|
"sponsorship_mode": "sponsored_company",
|
|
"sponsor_org_root_id": "org_company_a",
|
|
"tx": {
|
|
"from": "0x2299547f6fA9A8f9b6d9aEA9F9D8A4B53C8A0e11",
|
|
"to": "0x1111111111111111111111111111111111111111",
|
|
"data": "0xdeadbeef",
|
|
"value": "0x0"
|
|
}
|
|
}
|
|
```
|
|
|
|
Error (`403` not verified):
|
|
|
|
```json
|
|
{
|
|
"error": "Signature verification is required before quote issuance.",
|
|
"code": "signature_not_verified",
|
|
"correlation_id": "req_b2fd89f71a4d17d4"
|
|
}
|
|
```
|
|
|
|
Error (`403` distinct payer without proof):
|
|
|
|
```json
|
|
{
|
|
"error": "distinct payer requires ownership proof",
|
|
"code": "request_failed"
|
|
}
|
|
```
|
|
|
|
## 4) `POST /secret/membership/confirm`
|
|
|
|
Request:
|
|
|
|
```json
|
|
{
|
|
"designation_code": "0217073045482",
|
|
"quote_id": "mq_01HZZX4F8VQXJ6A57R8P3SCB2W",
|
|
"tx_hash": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
"address": "0x3ea6cbf98d23e2cf7b6f4f9bb1fb4f50b710f2d5",
|
|
"chain_id": 8453
|
|
}
|
|
```
|
|
|
|
Success (`200`):
|
|
|
|
```json
|
|
{
|
|
"status": "membership_active",
|
|
"designation_code": "0217073045482",
|
|
"display_token": "0217-0730-4548-2",
|
|
"tx_hash": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
"activated_at": "2026-02-17T07:33:09Z"
|
|
}
|
|
```
|
|
|
|
Error (`400` tx mismatch):
|
|
|
|
```json
|
|
{
|
|
"error": "Transaction amount or destination does not match quote policy.",
|
|
"code": "tx_mismatch",
|
|
"correlation_id": "req_6d1227be9f9b75cc"
|
|
}
|
|
```
|
|
|
|
## 5) `GET /secret/membership/status`
|
|
|
|
Request by wallet:
|
|
|
|
`GET /secret/membership/status?wallet=0x3ea6cbf98d23e2cf7b6f4f9bb1fb4f50b710f2d5`
|
|
|
|
Success (`200`):
|
|
|
|
```json
|
|
{
|
|
"status": "active",
|
|
"wallet": "0x3ea6cbf98d23e2cf7b6f4f9bb1fb4f50b710f2d5",
|
|
"designation_code": "0217073045482"
|
|
}
|
|
```
|
|
|
|
Error (`400` missing selectors):
|
|
|
|
```json
|
|
{
|
|
"error": "Provide wallet or designation_code.",
|
|
"code": "missing_selector",
|
|
"correlation_id": "req_f23618fdd4479b89"
|
|
}
|
|
```
|