title | description |
---|---|
Quickstart |
Welcome to Gateway Protocol! Get started with Gateway in minutes |
Quickest way to start with Gateway Protocol is to use our SDK.
- Node.js v18
- A package manager like npm, yarn, or pnpm
- Basic knowledge of JavaScript
Let's start a new project and install the SDK.
Create a new directory for your project and navigate into it.
mkdir my-gateway-project
cd my-gateway-project
npm init -y
Install the SDK using your favorite package manager.
npm install @gateway-dao/sdk
yarn add @gateway-dao/sdk
pnpm install @gateway-dao/sdk
You will need an API key to use the SDK. You can get it from the Gateway Protocol dashboard.
For the testnet version you would have to create an Organization, which can be done from the dashboard. Just click on your profile on the bottom left corner and click on Create Organization
.
Once you have created an organization, your Developer Access
section will be unlocked.
If you are just playing around with the SDK, you can use the Sandbox version which doesn't need creating an organization.
Once you are logged in to the dashboard, navigate to the Developer Access
section and you can find your API key there.
Create a new file called index.js
and add the following code to it.
import {
Gateway,
UserIdentifierType,
OrganizationIdentifierType,
} from "@gateway-dao/sdk";
const gateway = new Gateway({
apiKey: "your-api-key", // Replace with your actual API key from the dashboard
token: "your-token", // Replace with your Access token from the dashboard
url: "https://protocol.mygateway.xyz/graphql", // Pointing to testnet
});
async function main() {
try {
let obj = {
dataModelId: "7f1e400e-b761-4e35-913d-09e500f36e79",
description: "TESTING MODEL",
title: "TESTING MODEL",
claim: {
model_id: "123",
},
owner: {
type: UserIdentifierType.GATEWAY_ID,
value: "YOUR_GATEWAY_ID",
},
organization: {
type: OrganizationIdentifierType.GATEWAY_ID,
value: "YOUR_ORG_ID",
},
};
const { createPDA } = await gateway.pda.createPDA(obj);
console.log(createPDA);
} catch (error) {
console.log(error); // Can log it for debugging
}
}
main();
Replace your-api-key
and your-token
with your actual API key and token.
Run the code using your favorite JavaScript runtime.
node index.js
You should see the output of the createPDA
mutation in the console.
That's it! You have successfully created a new PDA using the Gateway Protocol SDK.