Sign 백서

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 14쪽 중 10쪽

0000000000000000000000000000012486f6d65776f726b2f446166742050756e6b0000000000000000000000000000"; <strong>const schemaData = `[{"name":"contractDetails","type":"string"},{"name":"signer","type":"address"}]`; </strong>const res = decodeOnChainData( attestationData, DataLocationOnChain.ONCHAIN, JSON.parse(schemaData) ); </code></pre> # REST APIs ### Base Endpoints #### Testnet ``` https://testnet-rpc.sign.global/api ``` #### Mainnet ``` https://mainnet-rpc.sign.global/api ``` ### Hello World ```typescript GET / index; ``` Status endpoint to verify the attestation backend is functional. Parameters: None Response: ```json { "success": true, "statusCode": 200, "data": "Welcome to Sign Protocol Service!", "message": "ok" } ``` ### Super Search ```typescript GET / scan / search; ``` Search for relevant schemas, attestations, and addresses by providing a keyword and filter. Query Parameters: | Key | Value | Type | | --------- | ----------- | ---------------------------------------- | | filter\* | attestation | `"schema"`, `"attestation"`, `"address"` | | keyword\* | 0x1 | string | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "queryResult": [ { "type": "attestation", "rows": [ { "id": "onchain_evm_80001_0x1", "chainType": "evm", "chainId": "80001", "attestationId": "0x1", "attester": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "recipients": [] }, ... ], "total": 2 } ] }, "message": "ok" } ``` ### Get Address Statistics ```typescript GET / scan / addresses / { address } / statistics; ``` Get attestation and schema statistics for an address. Query Parameters: | Key | Value | Type | | ------- | ------------------------------------------ | ------ | | address | 0x059e6B8008d34aC26581fD3ED8378AA93c7941EE | string | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "schemaCreated": 6, "totalAttestations": 14, "attestationCreated": 13, "attestationReceived": 3 }, "message": "ok" } ``` # Schemas ### Single Schema ```typescript GET / index / schemas / { id }; ``` Retrieve the data of a schema by providing a schema ID. Query Parameters: | Key | Value | Type | | --- | ------------------------ | ------ | | id | onchain\_evm\_80001\_0x1 | string | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "id": "onchain_evm_80001_0x1", "mode": "onchain", "chainType": "evm", "chainId": "80001", "schemaId": "0x1", "transactionHash": "0x97e69df2e65e97001da22953a4376233d792c50810cf3bff0fff1a14e7374b60", "name": "xxx", "description": "", "revocable": true, "maxValidFor": "0", "resolver": "0x0000000000000000000000000000000000000000", "registerTimestamp": "1705387959", "registrant": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "data": [ { "name": "name", "type": "string" } ] }, "message": "ok" } ``` ### Schema Info ```typescript GET / scan / schemas / { id }; ``` Get the data of a schema by providing the schema ID. Query Parameters: | | | | | -- | ------------------------ | ------ | | id | onchain\_evm\_80001\_0x2 | string | \* Optional parameters. Response: ```json { "success": true, "statusCode": 200, "data": { "id": "onchain_evm_80001_0x2", "mode": "onchain", "name": "message", "description": "", "registrant": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "registerTimestamp": 1705483984, "chainType": "evm", "chainId": "80001", "schemaId": "0x2", "revocable": true, "maxValidFor": 0, "transactionHash": "0xb1b7aa7da95aced199551f9fd58944551472027f2a6533bf462c4b435b03c789", "data": [ { "name": "message", "type": "string" } ] }, "message": "ok" } ``` ### Filtered Schemas ```typescript GET / index / schemas; ``` Query for a list of schemas using one or more filtering parameters. Results can be paginated with customizable page sizes. Query Parameters: | Key | Value | Type | | ------------ | ------------------------------------------ | -------------------- | | id\* | onchain\_evm\_7001\_0x7 | string | | page\* | 1 | number | | registrant\* | 0xDfc4FbbDd9C47c7976fEBb14B1D37C7f85FE299D | string | | size\* | 100 | number | | mode\* | onchain | "onchain"/"offchain" | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "total": 20, "rows": [ { "id": "onchain_evm_7001_0x7", "mode": "onchain", "chainType": "evm", "chainId": "7001", "schemaId": "0x7", "transactionHash": "0xabddd6fe182a75d61eb0feef028a71a24fbdf46e7508c519c099c9d8a5805801", "name": "test", "description": "whasa", "revocable": true, "maxValidFor": "0", "resolver": "0x0000000000000000000000000000000000000000", "registerTimestamp": "1705912991", "registrant": "0xDfc4FbbDd9C47c7976fEBb14B1D37C7f85FE299D", "data": [ { "name": "name", "type": "string" }, { "name": "count", "type": "number" } ] } ], "size": "1", "page": 1 }, "message": "ok" } ``` ### Top 10 Schemas ```typescript GET / scan / top - schemas; ``` Get the current top 10 schemas from the attestation backend. Query Parameters: None Response: ```json { "success": true, "statusCode": 200, "data": { "rows": [ { "id": "onchain_evm_7001_0x4", "mode": "onchain", "name": "zeta kyc schema", "description": "", "registrant": "0x8D10D37BF3c50C9Dd34A4BC70987CD60f8f4a466", "chainType": "evm", "chainId": "7001", "schemaId": "0x4", "transactionHash": "0x8736b25a8c7644721791ddc544f39e49418bf1516378aa9386a0b2c47baf6c53", "attestationCount": 18 }, ... ] }, "message": "ok" } ``` ### Trending Schemas ```typescript GET / scan / trending - schemas; ``` Get the top trending schemas from the attestation backend. Query Parameters: None Response: ```json { "success": true, "statusCode": 200, "data": { "rows": [ { "id": "onchain_evm_80001_0x1", "mode": "onchain", "name": "xxx", "description": "", "registrant": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "chainType": "evm", "chainId": "80001", "schemaId": "0x1", "transactionHash": "0x97e69df2e65e97001da22953a4376233d792c50810cf3bff0fff1a14e7374b60", "attestationCount": 1 } ] }, "message": "ok" } ``` ### Latest 10 Schemas ```typescript GET / scan / latest - attestations; ``` Get the most recently created 10 schemas from the attestation backend. Query Parameters: None Response: ```json { "success": true, "statusCode": 200, "data": { "rows": [ { "id": "onchain_evm_80001_0x21", "mode": "onchain", "chainType": "evm", "chainId": "80001", "attestationId": "0x21", "schemaId": "0x1", "attester": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "attestTimestamp": "1706065910", "recipients": [], "schema": { "id": "onchain_evm_80001_0x1", "schemaId": "0x1", "name": "xxx" } }, ... ] }, "message": "ok" } ``` ### Paged Schemas ```typescript GET / scan / schemas; ``` Query schemas by providing a keyword. Results may be paged if the query returns many results. Query Parameters: | Key | Value | Type | | --------- | ----- | ------ | | page\* | 1 | number | | keyword\* | 0x1 | string | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "total": 23, "rows": [ { "id": "onchain_evm_80001_0x1", "mode": "onchain", "name": "xxx", "description": "", "registrant": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "chainType": "evm", "chainId": "80001", "schemaId": "0x1", "transactionHash": "0x97e69df2e65e97001da22953a4376233d792c50810cf3bff0fff1a14e7374b60", "attestationCount": 17, "attesterCount": 2, "data": [ { "name": "name", "type": "string" } ] }, ... ], "page": 1, "size": 10 }, "message": "ok" } ``` ### Address Schemas ```typescript GET / scan / addresses / { address } / schemas; ``` Get a list of schemas that a given address has created. Query Parameters: | Key | Value | Type | | ------- | ------------------------------------------ | ------ | | address | 0x059e6B8008d34aC26581fD3ED8378AA93c7941EE | string | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "total": 12, "rows": [ { "id": "onchain_evm_80001_0x4", "mode": "onchain", "chainType": "evm", "chainId": "80001", "schemaId": "0x4", "transactionHash": "0xe2bb19cfd5d45e20e2cc36cb5c6ef2a947c25fc006a3386a260520646fe35837", "name": "message", "description": "", "revocable": true, "maxValidFor": "0", "resolver": "0x0000000000000000000000000000000000000000", "registerTimestamp": "1705484040", "registrant": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "data": [ { "name": "message", "type": "string" } ], "extra": null, "syncAt": "1705932587177" }, ... ], "page": 1, "size": 10 }, "message": "ok" } ``` # Attestations ### Single Attestation ``` GET /index/attestations/{id} ``` Retrieve the data of an attestation by providing an attestation ID. Query Parameters: | Key | Value | Type | | --- | ------------------------ | ------ | | id | onchain\_evm\_80001\_0x3 | string | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "id": "onchain_evm_80001_0x3", "mode": "onchain", "chainType": "evm", "chainId": "80001", "attestationId": "0x3", "transactionHash": "0x9e83cc789a457e0bcaa0cd5457c6a1aae4f4db8138193a3179ef33059d82f6d6", "indexingValue": "0x059e6B8008d34aC26581fD3ED8378AA93c7941EE", "schemaId": "0x1", "fullSchemaId": "onchain_evm_80001_0x1", "linkedAttestation": "", "attester": "0x059e6B8008d34aC26581fD3ED8378AA93c7941EE", "attestTimestamp": "1705485146", "validUntil": "0", "revoked": false, "revokeTimestamp": null, "revokeReason": null, "revokeTransactionHash": "", "data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000033232320000000000000000000000000000000000000000000000000000000000", "dataLocation": "ONCHAIN", "extra": "{}", "syncAt": "1705653417309", "lastSyncAt": null, "recipients": [], "schema": { "id": "onchain_evm_80001_0x1", "mode": "onchain", "chainType": "evm", "chainId": "80001", "schemaId": "0x1", "transactionHash": "0x97e69df2e65e97001da22953a4376233d792c50810cf3bff0fff1a14e7374b60", "name": "xxx", "description": "", "revocable": true, "maxValidFor": "0", "resolver": "0x0000000000000000000000000000000000000000", "registerTimestamp": "1705387959", "registrant": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "data": [ { "name": "name", "type": "string" } ], "extra": null, "syncAt": "1705932587177" } }, "message": "ok" } ``` ### Attestation Info ```typescript GET / scan / attestations / { id }; ``` Get the data of an attestation by providing the attestation ID. Query Parameters: | Key | Value | Type | | --- | ------------------------ | ------ | | id | onchain\_evm\_80001\_0xd | string | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "id": "onchain_evm_80001_0xd", "mode": "onchain", "chainType": "evm", "chainId": "80001", "attestationId": "0xd", "transactionHash": "0x5154a89cc54e30d2d9a0c53aedbebdf1a07e864287d52696af352899bba913fe", "indexingValue": "0x059e6B8008d34aC26581fD3ED8378AA93c7941EE", "schemaId": "0x1", "fullSchemaId": "onchain_evm_80001_0x1", "linkedAttestation": "", "attester": "0x059e6B8008d34aC26581fD3ED8378AA93c7941EE", "attestTimestamp": "1705542705", "validUntil": "0", "revoked": false, "revokeTimestamp": null, "revokeReason": null, "revokeTransactionHash": "", "data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000033232320000000000000000000000000000000000000000000000000000000000", "dataLocation": "ONCHAIN", "recipients": [ "0x059e6B8008d34aC26581fD3ED8378AA93c7941EE", "0x2e6CEFDe38e2363be4CE8497bee68E23004ADfB4" ], "schema": { "id": "onchain_evm_80001_0x1", "schemaId": "0x1", "name": "xxx", "data": [ { "name": "name", "type": "string" } ] } }, "message": "ok" } ``` ### Filtered Attestations ```typescript GET / index / attestations; ``` Query for a list of attestations using one or more filtering parameters. Results can be paginated with customizable page sizes. Query Parameters: | Key | Value | Type | | --------------- | ------------------------------------------ | -------------------- | | id\* | onchain\_evm\_80001\_0xb | string | | page\* | 1 | number | | mode\* | onchain | "onchain"/"offchain" | | indexingValue\* | 0x34A6d2B552c34be8136d18773Fa79036c8315180 | string | | schemaId\* | onchain\_evm\_80001\_0x3 | string | | attester\* | 0x8d10d37bf3c50c9dd34a4bc70987cd60f8f4a463 | string | | size\* | 100 | number | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "total": 1, "rows": [ { "id": "onchain_evm_80001_0xb", "mode": "onchain", "chainType": "evm", "chainId": "80001", "attestationId": "0xb", "transactionHash": "0xd6a6207a429a7fcc02dedf60db021befb3c2fd8296086f386f5595985c4ccea3", "indexingValue": "0x059e6B8008d34aC26581fD3ED8378AA93c7941EE", "schemaId": "0x1", "fullSchemaId": "onchain_evm_80001_0x1", "linkedAttestation": "", "attester": "0x059e6B8008d34aC26581fD3ED8378AA93c7941EE", "attestTimestamp": "1705485350", "validUntil": "0", "revoked": true, "revokeTimestamp": "1705912687", "revokeReason": null, "revokeTransactionHash": "0x031e6400760d517f2ec008e017dc3be0fecceb6b583aa61505e4f19e93c5a7b9", "data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000033232320000000000000000000000000000000000000000000000000000000000", "dataLocation": "ONCHAIN", "extra": "{}", "syncAt": "1705653417309", "lastSyncAt": null, "recipients": [], "schema": { "id": "onchain_evm_80001_0x1", "mode": "onchain", "chainType": "evm", "chainId": "80001", "schemaId": "0x1", "transactionHash": "0x97e69df2e65e97001da22953a4376233d792c50810cf3bff0fff1a14e7374b60", "name": "xxx", "description": "", "revocable": true, "maxValidFor": "0", "resolver": "0x0000000000000000000000000000000000000000", "registerTimestamp": "1705387959", "registrant": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "data": [ { "name": "name", "type": "string" } ], "extra": null, "syncAt": "1705932587177" } } ], "size": 100, "page": 1 }, "message": "ok" } ``` ### Filter Attestations by Schema ```typescript GET / scan / attestations; ``` Get attestations for a schema by providing the relevant schema ID. Query Parameters: | Key | Value | Type | | -------- | ------------------------ | ------ | | schemaId | onchain\_evm\_80001\_0x1 | string | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "total": 17, "rows": [ { "id": "onchain_evm_80001_0x21", "mode": "onchain", "chainType": "evm", "chainId": "80001", "attestationId": "0x21", "schemaId": "0x1", "attester": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "attestTimestamp": "1706065910", "recipients": [] }, ... ], "page": 1, "size": 10 }, "message": "ok" } ``` ### Paged Attestations ```typescript GET / scan / attestations; ``` Query attestations by providing the fields and a relevant keyword. Results may be paged if the query returns many results. Query Parameters: | Key | Value | Type | | --------- | ------ | -------- | | fields\* | detail | "detail" | | page\* | 1 | number | | keyword\* | 0x1 | string | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "total": 52, "rows": [ { "id": "onchain_evm_80001_0x21", "mode": "onchain", "chainType": "evm", "chainId": "80001", "attestationId": "0x21", "schemaId": "0x1", "attester": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "attestTimestamp": "1706065910", "recipients": [], "schema": { "id": "onchain_evm_80001_0x1", "chainType": "evm", "chainId": "80001", "schemaId": "0x1", "name": "xxx" } }, ... ], "page": 1, "size": 10 }, "message": "ok" } ``` ### Address Attestations ```typescript GET / scan / addresses / { address } / attestations; ``` Get a list of addresses that a given address has created. Query Parameters: | Key | Value | Type | | ------- | ------------------------------------------ | ------ | | address | 0x059e6B8008d34aC26581fD3ED8378AA93c7941EE | string | \* Optional parameter. Response: ```json { "success": true, "statusCode": 200, "data": { "total": 14, "rows": [ { "id": "onchain_evm_80001_0x4", "mode": "onchain", "chainType": "evm", "chainId": "80001", "attestationId": "0x4", "transactionHash": "0xe0fcf6d8e3fc2040e2fc94395144d15ca43fba75de247f650150772e2692b768", "indexingValue": "0x059e6B8008d34aC26581fD3ED8378AA93c7941EE", "schemaId": "0x1", "fullSchemaId": "onchain_evm_80001_0x1", "linkedAttestation": "", "attester": "0x059e6B8008d34aC26581fD3ED8378AA93c7941EE", "attestTimestamp": "1705485310", "validUntil": "0", "revoked": false, "revokeTimestamp": null, "revokeReason": null, "revokeTransactionHash": "", "data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000033232320000000000000000000000000000000000000000000000000000000000", "dataLocation": "ONCHAIN", "extra": "{}", "syncAt": "1705653417309", "lastSyncAt": null, "recipients": [], "schema": { "id": "onchain_evm_80001_0x1", "schemaId": "0x1", "name": "xxx", "description": "" } }, ... ], "page": 1, "size": 10 }, "message": "ok" } ``` # GraphQL # Schemas ### Single Schema ```typescript POST / graphql; ``` Retrieve the data of a schema by querying with a schema ID. Body Parameters: ```graphql # Write your query or mutation here query getSchema { schema(id: "onchain_evm_80001_0x3") { id mode chainType chainId schemaId transactionHash name description revocable maxValidFor resolver registerTimestamp registrant data } } ``` Response: ```json { "data": { "schema": { "id": "onchain_evm_80001_0x3", "mode": "onchain", "chainType": "evm", "chainId": "80001", "schemaId": "0x3", "transactionHash": "0x73a6b43255ada4b165b55477f34fa4baa44d9090e6ecb6a145274e15ae0865b6", "name": "message", "description": "", "revocable": true, "maxValidFor": 0, "resolver": "0x0000000000000000000000000000000000000000", "registerTimestamp": 1705484022, "registrant": "0x9854E76134e6D729A633CED51042fF653f04f4C5", "data": "[{\"name\":\"message\",\"type\":\"string\"}]" } } } ``` ### Filtered Schemas ```typescript POST / graphql; ``` Query for a list of schemas. Results can be filtered, paginated, ordered, etc. according to GraphQL standards. Body Parameters: ```graphql query querySchemas { pagedSchemas(page: 1, size: 10) { total page size schemas { id mode chainType chainId schemaId transactionHash name description revocable maxValidFor resolver registerTimestamp registrant data } } } ``` Response: ```json { "data": { "pagedSchemas": { "total": 20, "page": 1, "size": 10, "schemas": [ { "id": "onchain_evm_7001_0x7", "mode": "onchain", "chainType": "evm", "chainId": "7001", "schemaId": "0x7", "transactionHash": "0xabddd6fe182a75d61eb0feef028a71a24fbdf46e7508c519c099c9d8a5805801", "name": "test", "description": "whasa", "revocable": true, "maxValidFor": 0, "resolver": "0x0000000000000000000000000000000000000000", "registerTimestamp": 1705912991, "registrant": "0xDfc4FbbDd9C47c7976fEBb14B1D37C7f85FE299D", "data": "[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"count\",\"type\":\"number\"}]" }, ... ] } } } ``` # Attestations ### Single Attestation ```typescript POST / graphql; ``` Retrieve the data of an a
프로젝트로 돌아가기