@wuwei-labs/srsly
Version:
TypeScript SDK for SRSLY
145 lines • 10 kB
JavaScript
"use strict";
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.SrslyInstruction = exports.SrslyAccount = exports.SRSLY_PROGRAM_ADDRESS = void 0;
exports.identifySrslyAccount = identifySrslyAccount;
exports.identifySrslyInstruction = identifySrslyInstruction;
const kit_1 = require("@solana/kit");
exports.SRSLY_PROGRAM_ADDRESS = 'SRSLYxcFnjd5jG2DpJw4as6UEyjwJQK1U4J1TD1hvZH';
var SrslyAccount;
(function (SrslyAccount) {
SrslyAccount[SrslyAccount["BorrowerState"] = 0] = "BorrowerState";
SrslyAccount[SrslyAccount["ConfigState"] = 1] = "ConfigState";
SrslyAccount[SrslyAccount["ContractState"] = 2] = "ContractState";
SrslyAccount[SrslyAccount["RentalState"] = 3] = "RentalState";
})(SrslyAccount || (exports.SrslyAccount = SrslyAccount = {}));
function identifySrslyAccount(account) {
const data = 'data' in account ? account.data : account;
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([160, 47, 174, 209, 255, 213, 193, 235])), 0)) {
return SrslyAccount.BorrowerState;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([193, 77, 160, 128, 208, 254, 180, 135])), 0)) {
return SrslyAccount.ConfigState;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([190, 138, 10, 223, 189, 116, 222, 115])), 0)) {
return SrslyAccount.ContractState;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([97, 162, 29, 222, 251, 251, 180, 244])), 0)) {
return SrslyAccount.RentalState;
}
throw new Error('The provided account could not be identified as a srsly account.');
}
var SrslyInstruction;
(function (SrslyInstruction) {
SrslyInstruction[SrslyInstruction["AcceptRental"] = 0] = "AcceptRental";
SrslyInstruction[SrslyInstruction["CancelRental"] = 1] = "CancelRental";
SrslyInstruction[SrslyInstruction["ClaimBorrower"] = 2] = "ClaimBorrower";
SrslyInstruction[SrslyInstruction["ClaimContract"] = 3] = "ClaimContract";
SrslyInstruction[SrslyInstruction["CloseBorrower"] = 4] = "CloseBorrower";
SrslyInstruction[SrslyInstruction["CloseContract"] = 5] = "CloseContract";
SrslyInstruction[SrslyInstruction["CloseContractThread"] = 6] = "CloseContractThread";
SrslyInstruction[SrslyInstruction["CloseRental"] = 7] = "CloseRental";
SrslyInstruction[SrslyInstruction["CreateBorrower"] = 8] = "CreateBorrower";
SrslyInstruction[SrslyInstruction["CreateConfig"] = 9] = "CreateConfig";
SrslyInstruction[SrslyInstruction["CreateContract"] = 10] = "CreateContract";
SrslyInstruction[SrslyInstruction["CreateContractThread"] = 11] = "CreateContractThread";
SrslyInstruction[SrslyInstruction["DeleteBorrower"] = 12] = "DeleteBorrower";
SrslyInstruction[SrslyInstruction["DeleteConfig"] = 13] = "DeleteConfig";
SrslyInstruction[SrslyInstruction["DeleteContract"] = 14] = "DeleteContract";
SrslyInstruction[SrslyInstruction["DeleteContractThread"] = 15] = "DeleteContractThread";
SrslyInstruction[SrslyInstruction["DeleteRental"] = 16] = "DeleteRental";
SrslyInstruction[SrslyInstruction["InvalidateRental"] = 17] = "InvalidateRental";
SrslyInstruction[SrslyInstruction["ProcessContract"] = 18] = "ProcessContract";
SrslyInstruction[SrslyInstruction["ReleaseRental"] = 19] = "ReleaseRental";
SrslyInstruction[SrslyInstruction["ReserveRental"] = 20] = "ReserveRental";
SrslyInstruction[SrslyInstruction["SetDelegate"] = 21] = "SetDelegate";
SrslyInstruction[SrslyInstruction["UpdateConfig"] = 22] = "UpdateConfig";
SrslyInstruction[SrslyInstruction["UpdateContract"] = 23] = "UpdateContract";
SrslyInstruction[SrslyInstruction["UpdateContractThread"] = 24] = "UpdateContractThread";
})(SrslyInstruction || (exports.SrslyInstruction = SrslyInstruction = {}));
function identifySrslyInstruction(instruction) {
const data = 'data' in instruction ? instruction.data : instruction;
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([192, 221, 241, 212, 141, 161, 36, 146])), 0)) {
return SrslyInstruction.AcceptRental;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([97, 204, 63, 8, 84, 34, 28, 43])), 0)) {
return SrslyInstruction.CancelRental;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([110, 181, 137, 36, 71, 243, 38, 219])), 0)) {
return SrslyInstruction.ClaimBorrower;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([159, 37, 59, 144, 75, 50, 2, 170])), 0)) {
return SrslyInstruction.ClaimContract;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([136, 79, 95, 44, 18, 151, 73, 199])), 0)) {
return SrslyInstruction.CloseBorrower;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([37, 244, 34, 168, 92, 202, 80, 106])), 0)) {
return SrslyInstruction.CloseContract;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([213, 35, 77, 150, 62, 109, 103, 248])), 0)) {
return SrslyInstruction.CloseContractThread;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([179, 188, 113, 211, 41, 232, 51, 51])), 0)) {
return SrslyInstruction.CloseRental;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([203, 62, 59, 250, 206, 172, 88, 214])), 0)) {
return SrslyInstruction.CreateBorrower;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([201, 207, 243, 114, 75, 111, 47, 189])), 0)) {
return SrslyInstruction.CreateConfig;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([244, 48, 244, 178, 216, 88, 122, 52])), 0)) {
return SrslyInstruction.CreateContract;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([233, 57, 214, 37, 246, 233, 143, 139])), 0)) {
return SrslyInstruction.CreateContractThread;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([89, 147, 185, 127, 231, 56, 190, 45])), 0)) {
return SrslyInstruction.DeleteBorrower;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([219, 237, 110, 222, 219, 239, 70, 237])), 0)) {
return SrslyInstruction.DeleteConfig;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([189, 115, 12, 22, 241, 49, 35, 6])), 0)) {
return SrslyInstruction.DeleteContract;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([113, 179, 247, 242, 60, 125, 240, 68])), 0)) {
return SrslyInstruction.DeleteContractThread;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([252, 24, 115, 220, 135, 174, 69, 172])), 0)) {
return SrslyInstruction.DeleteRental;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([180, 183, 106, 153, 255, 8, 232, 178])), 0)) {
return SrslyInstruction.InvalidateRental;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([203, 109, 39, 44, 150, 50, 210, 78])), 0)) {
return SrslyInstruction.ProcessContract;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([99, 35, 221, 147, 185, 205, 23, 12])), 0)) {
return SrslyInstruction.ReleaseRental;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([5, 180, 4, 150, 64, 120, 189, 128])), 0)) {
return SrslyInstruction.ReserveRental;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([242, 30, 46, 76, 108, 235, 128, 181])), 0)) {
return SrslyInstruction.SetDelegate;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([29, 158, 252, 191, 10, 83, 219, 99])), 0)) {
return SrslyInstruction.UpdateConfig;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([78, 184, 162, 174, 233, 5, 40, 82])), 0)) {
return SrslyInstruction.UpdateContract;
}
if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([183, 75, 119, 98, 134, 24, 187, 91])), 0)) {
return SrslyInstruction.UpdateContractThread;
}
throw new Error('The provided instruction could not be identified as a srsly instruction.');
}
//# sourceMappingURL=srsly.js.map