@peke65/attest-sdk v0.0.27-new
AttestSDK
AttestSDK is a JavaScript library for interacting with the Attest API, enabling easy management of schemas within the Solana blockchain.
Installation
You can install the package via npm:
npm install @attestprotocol/sdkUsage
To use the SDK, you need to import it and create an instance of the AttestSDK class:
import AttestSDK from '@attestprotocol/sdk';
async function run() {
const secretKey = [/* your secret key here */];
const client = await AttestSDK.initializeSolana({
url,
walletOrSecretKey: secretKey,
})
const { data: schema, error: schemaError } = await client.createSchema({
schemaName: 'test-schema',
schemaContent: 'string name, string email, uint8 verification_level',
revocable: true,
levy: {
amount: new anchor.BN(10),
asset: mintAcount,
recipient: authorityKeypair.publicKey,
},
})
console.log({ schema });
const fetchSchema = await client.fetchSchema(schema!)
console.log({ fetchSchema })
}
run();Features
- Register Schema: Register a new schema with a name and content.
- Fetch Schema: Retrieve an existing schema by its ID.
- Create Attestation: Create an attestation based on a schema.
- Revoke Attestation: Revoke an attestation.
Running Tests
Solana Tests
yarn test-solanaStellar Tests
Stellar tests require funded accounts on the Stellar Testnet and access to deployed Soroban contracts. Before running the tests:
Fund the test accounts using the Stellar Friendbot:
Verify contract deployment:
- The default Protocol Contract ID is: CBPL7XR7NNPTNSIIFWQMWLSCX3B3MM36UYX4TW3QXJKTIEA6KDLRYAQP
- The default Authority Contract ID is: CDQREK6BTPEVD4O56XR6TKLEEMNYTRJUG466J2ERNE5POIEKN2N6O7EL
- You can override these addresses using command-line arguments (see below)
Run the tests:
yarn test-stellarCommand-line options:
--force-continue: Bypass the funding check (test will likely fail with unfunded accounts)--protocol=<address>: Override the protocol contract address--authority=<address>: Override the authority contract address--token=<address>: Set a token contract address for authority initialization--testnet: Specify that you're using the Stellar testnet
# Example with custom contracts
yarn test-stellar -- --protocol=CBFL7XR7NNPTNSIIFWQMWLSCX3B3MM36UYX4TW3QXJKTIEA6KDLRYAQZ --authority=CDQR4K6BTPEVD4O56XR6TKLEEMNYTRJUG466J2ERNE5POIEKN2N6O7EM6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
6 months ago
7 months ago
7 months ago
7 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago