@fastnear/borsh-schema
Version:
NEAR Protocol's borsh schema for common applications
169 lines • 4.09 kB
JavaScript
/* ⋈ 🏃🏻💨 FastNEAR Borsh Schema - ESM (@fastnear/borsh-schema version 0.9.7) */
/* https://www.npmjs.com/package/@fastnear/borsh-schema/v/0.9.7 */
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
const nearChainSchema = new class BorshSchema {
static {
__name(this, "BorshSchema");
}
Ed25519Signature = {
struct: {
data: { array: { type: "u8", len: 64 } }
}
};
Secp256k1Signature = {
struct: {
data: { array: { type: "u8", len: 65 } }
}
};
Signature = {
enum: [
{ struct: { ed25519Signature: this.Ed25519Signature } },
{ struct: { secp256k1Signature: this.Secp256k1Signature } }
]
};
Ed25519Data = {
struct: {
data: { array: { type: "u8", len: 32 } }
}
};
Secp256k1Data = {
struct: {
data: { array: { type: "u8", len: 64 } }
}
};
PublicKey = {
enum: [
{ struct: { ed25519Key: this.Ed25519Data } },
{ struct: { secp256k1Key: this.Secp256k1Data } }
]
};
FunctionCallPermission = {
struct: {
allowance: { option: "u128" },
receiverId: "string",
methodNames: { array: { type: "string" } }
}
};
FullAccessPermission = {
struct: {}
};
AccessKeyPermission = {
enum: [
{ struct: { functionCall: this.FunctionCallPermission } },
{ struct: { fullAccess: this.FullAccessPermission } }
]
};
AccessKey = {
struct: {
nonce: "u64",
permission: this.AccessKeyPermission
}
};
CreateAccount = {
struct: {}
};
DeployContract = {
struct: {
code: { array: { type: "u8" } }
}
};
FunctionCall = {
struct: {
methodName: "string",
args: { array: { type: "u8" } },
gas: "u64",
deposit: "u128"
}
};
Transfer = {
struct: {
deposit: "u128"
}
};
Stake = {
struct: {
stake: "u128",
publicKey: this.PublicKey
}
};
AddKey = {
struct: {
publicKey: this.PublicKey,
accessKey: this.AccessKey
}
};
DeleteKey = {
struct: {
publicKey: this.PublicKey
}
};
DeleteAccount = {
struct: {
beneficiaryId: "string"
}
};
ClassicAction = {
enum: [
{ struct: { createAccount: this.CreateAccount } },
{ struct: { deployContract: this.DeployContract } },
{ struct: { functionCall: this.FunctionCall } },
{ struct: { transfer: this.Transfer } },
{ struct: { stake: this.Stake } },
{ struct: { addKey: this.AddKey } },
{ struct: { deleteKey: this.DeleteKey } },
{ struct: { deleteAccount: this.DeleteAccount } }
]
};
DelegateAction = {
struct: {
senderId: "string",
receiverId: "string",
actions: { array: { type: this.ClassicAction } },
nonce: "u64",
maxBlockHeight: "u64",
publicKey: this.PublicKey
}
};
SignedDelegate = {
struct: {
delegateAction: this.DelegateAction,
signature: this.Signature
}
};
Action = {
enum: [
{ struct: { createAccount: this.CreateAccount } },
{ struct: { deployContract: this.DeployContract } },
{ struct: { functionCall: this.FunctionCall } },
{ struct: { transfer: this.Transfer } },
{ struct: { stake: this.Stake } },
{ struct: { addKey: this.AddKey } },
{ struct: { deleteKey: this.DeleteKey } },
{ struct: { deleteAccount: this.DeleteAccount } },
{ struct: { signedDelegate: this.SignedDelegate } }
]
};
Transaction = {
struct: {
signerId: "string",
publicKey: this.PublicKey,
nonce: "u64",
receiverId: "string",
blockHash: { array: { type: "u8", len: 32 } },
actions: { array: { type: this.Action } }
}
};
SignedTransaction = {
struct: {
transaction: this.Transaction,
signature: this.Signature
}
};
}();
const getBorshSchema = /* @__PURE__ */ __name(() => nearChainSchema, "getBorshSchema");
export {
getBorshSchema,
nearChainSchema
};
//# sourceMappingURL=index.js.map