updated js sdk

This commit is contained in:
Conner Gallagher 2023-06-28 12:03:35 -06:00
parent 63f774da52
commit 02f8ebfa3d
13 changed files with 1585 additions and 259 deletions

View File

@ -109,9 +109,9 @@ jobs:
SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f --clone
7nYabs9dUhvxYwdTnrWVBL9MYviKSfrEbdWCUbcnwkpF --clone
Fi8vncGpNKbq62gPo56G4toCehWNy77GgqGkTaAF5Lkk --clone
SBAPyGPyvYEXTiTEfVrktmpvm3Bae3VoZmjYZ6694Ha --clone
sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx --clone
FSD8p7tDkhffAiMgAvMXi9veJW1uSod4H3F3REn7nMNC --clone
GjWPcr9QrdHk8At821qcZPM9NPpCDGivaTCMQG5nWj2m --clone
5ExuoQR69trmKQfB95fDsUGsUrrChbGq9PFgt8qouncz --clone
CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd"
- name: Run Tests
working-directory: javascript/solana.js
@ -176,9 +176,9 @@ jobs:
SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f --clone
7nYabs9dUhvxYwdTnrWVBL9MYviKSfrEbdWCUbcnwkpF --clone
Fi8vncGpNKbq62gPo56G4toCehWNy77GgqGkTaAF5Lkk --clone
SBAPyGPyvYEXTiTEfVrktmpvm3Bae3VoZmjYZ6694Ha --clone
sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx --clone
FSD8p7tDkhffAiMgAvMXi9veJW1uSod4H3F3REn7nMNC --clone
GjWPcr9QrdHk8At821qcZPM9NPpCDGivaTCMQG5nWj2m --clone
5ExuoQR69trmKQfB95fDsUGsUrrChbGq9PFgt8qouncz --clone
CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd"
- name: Run Tests
working-directory: javascript/solana.js

View File

@ -38,10 +38,10 @@ address = "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd"
address = "7hkp1xfPBcD2t1vZMoWWQPzipHVcXeLAAaiGXdPSfDie"
[[test.validator.clone]] # sb devnet attestation programID
address = "SBAPyGPyvYEXTiTEfVrktmpvm3Bae3VoZmjYZ6694Ha"
address = "sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx"
[[test.validator.clone]] # sb devnet attestation IDL
address = "GjWPcr9QrdHk8At821qcZPM9NPpCDGivaTCMQG5nWj2m"
address = "5ExuoQR69trmKQfB95fDsUGsUrrChbGq9PFgt8qouncz"
[[test.validator.clone]] # sb SOL feed
address = "GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR"

View File

@ -32,8 +32,8 @@ address = "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd"
address = "7hkp1xfPBcD2t1vZMoWWQPzipHVcXeLAAaiGXdPSfDie"
# [[test.validator.clone]] # sb devnet attestation programID
# address = "SBAPyGPyvYEXTiTEfVrktmpvm3Bae3VoZmjYZ6694Ha"
# address = "sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx"
# [[test.validator.clone]] # sb devnet attestation IDL
# address = "GjWPcr9QrdHk8At821qcZPM9NPpCDGivaTCMQG5nWj2m"
# address = "5ExuoQR69trmKQfB95fDsUGsUrrChbGq9PFgt8qouncz"
[[test.validator.clone]] # sb devnet attestation State
address = "EuCumvrswq5HZC4ME1wh7Q7V6dN8DRetP3eM1gU4RPYp"

View File

@ -15,7 +15,7 @@
"@coral-xyz/anchor": "^0.28.0",
"@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.73.3",
"@switchboard-xyz/common": "^2.2.0",
"@switchboard-xyz/common": "^2.2.4",
"@switchboard-xyz/oracle": "^2.1.13",
"@switchboard-xyz/solana.js": "workspace:*"
},

View File

@ -35,7 +35,7 @@ address = "CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd"
address = "7hkp1xfPBcD2t1vZMoWWQPzipHVcXeLAAaiGXdPSfDie"
[[test.validator.clone]] # sb devnet attestation programID
address = "SBAPyGPyvYEXTiTEfVrktmpvm3Bae3VoZmjYZ6694Ha"
address = "sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx"
[[test.validator.clone]] # sb devnet attestation IDL
address = "GjWPcr9QrdHk8At821qcZPM9NPpCDGivaTCMQG5nWj2m"
address = "5ExuoQR69trmKQfB95fDsUGsUrrChbGq9PFgt8qouncz"

File diff suppressed because it is too large Load Diff

View File

@ -521,7 +521,7 @@
{
"name": "quote",
"isMut": false,
"isSigner": false
"isSigner": true
},
{
"name": "rewardWallet",
@ -1451,7 +1451,7 @@
{
"name": "quote",
"isMut": false,
"isSigner": false
"isSigner": true
},
{
"name": "programState",
@ -2551,97 +2551,6 @@
}
],
"accounts": [
{
"name": "QuoteAccountData",
"type": {
"kind": "struct",
"fields": [
{
"name": "delegatedSecuredSigner",
"type": "publicKey"
},
{
"name": "bump",
"type": "u8"
},
{
"name": "quoteRegistry",
"docs": [
"TODO: Add description"
],
"type": {
"array": [
"u8",
32
]
}
},
{
"name": "registryKey",
"docs": [
"Key to lookup the buffer data on IPFS or an alternative decentralized storage solution."
],
"type": {
"array": [
"u8",
64
]
}
},
{
"name": "attestationQueue",
"docs": [
"Queue used for attestation to verify a MRENCLAVE measurement."
],
"type": "publicKey"
},
{
"name": "mrEnclave",
"docs": [
"The quotes MRENCLAVE measurement dictating the contents of the secure enclave."
],
"type": {
"array": [
"u8",
32
]
}
},
{
"name": "verificationStatus",
"type": "u8"
},
{
"name": "verificationTimestamp",
"type": "i64"
},
{
"name": "validUntil",
"type": "i64"
},
{
"name": "isOnQueue",
"type": "bool"
},
{
"name": "lastHeartbeat",
"docs": [
"The last time the quote heartbeated."
],
"type": "i64"
},
{
"name": "ebuf",
"type": {
"array": [
"u8",
1024
]
}
}
]
}
},
{
"name": "SbState",
"type": {
@ -5775,6 +5684,132 @@
]
}
},
{
"name": "EnclaveAccountData",
"type": {
"kind": "struct",
"fields": [
{
"name": "enclaveSigner",
"docs": [
"The address of the signer generated within an enclave."
],
"type": "publicKey"
},
{
"name": "authority",
"docs": [
"The authority of the EnclaveAccount which is permitted to make account changes."
],
"type": "publicKey"
},
{
"name": "attestationQueue",
"docs": [
"Queue used for attestation to verify a MRENCLAVE measurement."
],
"type": "publicKey"
},
{
"name": "mrEnclave",
"docs": [
"The quotes MRENCLAVE measurement dictating the contents of the secure enclave."
],
"type": {
"array": [
"u8",
32
]
}
},
{
"name": "verificationStatus",
"docs": [
"The VerificationStatus of the quote."
],
"type": "u8"
},
{
"name": "verificationTimestamp",
"docs": [
"The unix timestamp when the quote was last verified."
],
"type": "i64"
},
{
"name": "validUntil",
"docs": [
"The unix timestamp when the quotes verification status expires."
],
"type": "i64"
},
{
"name": "createdAt",
"docs": [
"The unix timestamp when the quote was created."
],
"type": "i64"
},
{
"name": "quoteRegistry",
"docs": [
"The off-chain registry where the verifiers quote can be located."
],
"type": {
"array": [
"u8",
32
]
}
},
{
"name": "registryKey",
"docs": [
"Key to lookup the buffer data on IPFS or an alternative decentralized storage solution."
],
"type": {
"array": [
"u8",
64
]
}
},
{
"name": "isOnQueue",
"docs": [
"Whether the quote is located on the AttestationQueues buffer."
],
"type": "bool"
},
{
"name": "lastHeartbeat",
"docs": [
"The last time the quote heartbeated on-chain."
],
"type": "i64"
},
{
"name": "bump",
"docs": [
"The PDA bump. Only set for FunctionAccount quotes."
],
"type": "u8"
},
{
"name": "ebuf",
"docs": [
"Reserved."
],
"type": {
"array": [
"u8",
1024
]
}
}
]
}
},
{
"name": "Hash",
"type": {
@ -6769,6 +6804,9 @@
"type": {
"kind": "enum",
"variants": [
{
"name": "None"
},
{
"name": "VerificationPending"
},
@ -8171,6 +8209,11 @@
"code": 6102,
"name": "GenericError",
"msg": ""
},
{
"code": 6103,
"name": "InvalidAuthorityState",
"msg": ""
}
]
}

View File

@ -1,6 +1,6 @@
{
"name": "@switchboard-xyz/solana.js",
"version": "2.3.0-beta.8",
"version": "2.3.0-beta.9",
"author": "",
"license": "MIT",
"description": "A Typescript client to interact with Switchboard on Solana.",
@ -146,8 +146,8 @@
"keypair:create": "shx find ~/.config/solana/id.json || solana-keygen new -s --no-bip39-passphrase --outfile ~/.config/solana/id.json",
"localnet:down": "kill -9 $(pgrep command solana-test-validator) || exit 0",
"localnet": "tsx ./scripts/localnet.ts",
"local:validator": "shx mkdir -p .anchor/test-ledger || true; solana-test-validator -q -r --ledger .anchor/test-ledger --mint $(solana-keygen pubkey ~/.config/solana/id.json) --bind-address 0.0.0.0 --url https://api.devnet.solana.com --rpc-port 8899 --clone SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f `# programId` --clone 7nYabs9dUhvxYwdTnrWVBL9MYviKSfrEbdWCUbcnwkpF `# programDataAddress` --clone Fi8vncGpNKbq62gPo56G4toCehWNy77GgqGkTaAF5Lkk `# idlAddress` --clone SBAPyGPyvYEXTiTEfVrktmpvm3Bae3VoZmjYZ6694Ha `# sgxProgramId` --clone FSD8p7tDkhffAiMgAvMXi9veJW1uSod4H3F3REn7nMNC `# sgxProgramDataAddress` --clone GjWPcr9QrdHk8At821qcZPM9NPpCDGivaTCMQG5nWj2m `# sgxIdlAddress` --clone CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd `# programState` --clone 7hkp1xfPBcD2t1vZMoWWQPzipHVcXeLAAaiGXdPSfDie `# switchboardVault`",
"local:validator:mainnet": "solana-test-validator -q -r --ledger .anchor/test-ledger --mint $(solana-keygen pubkey ~/.config/solana/id.json) --bind-address 0.0.0.0 --rpc-port 8899 --url https://api.mainnet-beta.solana.com --clone SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f --clone 7nYabs9dUhvxYwdTnrWVBL9MYviKSfrEbdWCUbcnwkpF --clone Fi8vncGpNKbq62gPo56G4toCehWNy77GgqGkTaAF5Lkk --clone SBAPyGPyvYEXTiTEfVrktmpvm3Bae3VoZmjYZ6694Ha --clone FSD8p7tDkhffAiMgAvMXi9veJW1uSod4H3F3REn7nMNC --clone GjWPcr9QrdHk8At821qcZPM9NPpCDGivaTCMQG5nWj2m --clone CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd --clone J7nSEX8ADf3pVVicd6yKy2Skvg8iLePEmkLUisAAaioD",
"local:validator": "shx mkdir -p .anchor/test-ledger || true; solana-test-validator -q -r --ledger .anchor/test-ledger --mint $(solana-keygen pubkey ~/.config/solana/id.json) --bind-address 0.0.0.0 --url https://api.devnet.solana.com --rpc-port 8899 --clone SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f `# programId` --clone 7nYabs9dUhvxYwdTnrWVBL9MYviKSfrEbdWCUbcnwkpF `# programDataAddress` --clone Fi8vncGpNKbq62gPo56G4toCehWNy77GgqGkTaAF5Lkk `# idlAddress` --clone sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx `# sgxProgramId` --clone FSD8p7tDkhffAiMgAvMXi9veJW1uSod4H3F3REn7nMNC `# sgxProgramDataAddress` --clone 5ExuoQR69trmKQfB95fDsUGsUrrChbGq9PFgt8qouncz `# sgxIdlAddress` --clone CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd `# programState` --clone 7hkp1xfPBcD2t1vZMoWWQPzipHVcXeLAAaiGXdPSfDie `# switchboardVault`",
"local:validator:mainnet": "solana-test-validator -q -r --ledger .anchor/test-ledger --mint $(solana-keygen pubkey ~/.config/solana/id.json) --bind-address 0.0.0.0 --rpc-port 8899 --url https://api.mainnet-beta.solana.com --clone SW1TCH7qEPTdLsDHRgPuMQjbQxKdH2aBStViMFnt64f --clone 7nYabs9dUhvxYwdTnrWVBL9MYviKSfrEbdWCUbcnwkpF --clone Fi8vncGpNKbq62gPo56G4toCehWNy77GgqGkTaAF5Lkk --clone sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx --clone FSD8p7tDkhffAiMgAvMXi9veJW1uSod4H3F3REn7nMNC --clone 5ExuoQR69trmKQfB95fDsUGsUrrChbGq9PFgt8qouncz --clone CyZuD7RPDcrqCGbNvLCyqk6Py9cEZTKmNKujfPi3ynDd --clone J7nSEX8ADf3pVVicd6yKy2Skvg8iLePEmkLUisAAaioD",
"generate": "tsx ./scripts/generate-client.ts",
"build:old": "shx rm -rf lib || true; tsc -p tsconfig.cjs.json && tsc",
"build": "node esbuild.js",
@ -165,7 +165,7 @@
"@coral-xyz/borsh": "^0.28.0",
"@solana/spl-token": "^0.3.8",
"@solana/web3.js": "^1.77.3",
"@switchboard-xyz/common": "^2.2.3",
"@switchboard-xyz/common": "^2.2.4",
"cron-validator": "^1.3.1",
"dotenv": "^16.3.1",
"lodash": "^4.17.21"

View File

@ -85,7 +85,7 @@ export const SB_V2_PID = new PublicKey(
* Switchboard's Attestation Program ID
*/
export const SB_ATTESTATION_PID = new PublicKey(
"SBAPyGPyvYEXTiTEfVrktmpvm3Bae3VoZmjYZ6694Ha"
"sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx"
);
/**

View File

@ -41,7 +41,7 @@ export interface AttestationPermissionSetParams {
queueAuthority?: Keypair;
queue: PublicKey;
node: PublicKey;
enclave: PublicKey;
}
/**
* Account type dictating the level of permissions between a granter and a grantee.
@ -205,7 +205,7 @@ export class AttestationPermissionAccount extends Account<types.AttestationPermi
? params.queueAuthority.publicKey
: payer,
attestationQueue: params.queue,
node: params.node,
enclave: params.enclave,
}
),
],

View File

@ -234,7 +234,7 @@ export class AttestationQueueAccount extends Account<types.AttestationQueueAccou
permission:
new types.SwitchboardAttestationPermission.PermitNodeheartbeat(),
queue: this.publicKey,
node: enclaveAccount.publicKey,
enclave: enclaveAccount.publicKey,
});
permissionInit.combine(permissionSet);
}
@ -449,7 +449,7 @@ export class AttestationQueueAccount extends Account<types.AttestationQueueAccou
permission: verifierQuotePermissions1.publicKey,
authority: authority.publicKey,
attestationQueue: attestationQueueKeypair.publicKey,
node: verifierQuoteKeypair1.publicKey,
enclave: verifierQuoteKeypair1.publicKey,
}
)
);

View File

@ -17,7 +17,7 @@ export interface AttestationPermissionSetAccounts {
permission: PublicKey;
authority: PublicKey;
attestationQueue: PublicKey;
node: PublicKey;
enclave: PublicKey;
}
export const layout = borsh.struct([
@ -33,7 +33,7 @@ export function attestationPermissionSet(
{ pubkey: accounts.permission, isSigner: false, isWritable: true },
{ pubkey: accounts.authority, isSigner: true, isWritable: false },
{ pubkey: accounts.attestationQueue, isSigner: false, isWritable: false },
{ pubkey: accounts.node, isSigner: false, isWritable: false },
{ pubkey: accounts.enclave, isSigner: false, isWritable: false },
];
const identifier = Buffer.from([56, 253, 255, 201, 100, 153, 10, 76]);
const buffer = Buffer.alloc(1000);

View File

@ -2,7 +2,7 @@ import { PublicKey } from "@solana/web3.js";
// Program ID passed with the cli --program-id flag when running the code generator. Do not edit, it will get overwritten.
export const PROGRAM_ID_CLI = new PublicKey(
"SBAPyGPyvYEXTiTEfVrktmpvm3Bae3VoZmjYZ6694Ha"
"sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx"
);
// This constant will not get overwritten on subsequent code generations and it's safe to modify it's value.