@opendatalabs/vana-sdk
Version:
A TypeScript library for interacting with Vana Network smart contracts.
139 lines • 4.28 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var eip712_exports = {};
__export(eip712_exports, {
BUILDER_REGISTRATION_TYPES: () => BUILDER_REGISTRATION_TYPES,
FILE_DELETION_TYPES: () => FILE_DELETION_TYPES,
FILE_REGISTRATION_TYPES: () => FILE_REGISTRATION_TYPES,
GRANT_REGISTRATION_TYPES: () => GRANT_REGISTRATION_TYPES,
GRANT_REVOCATION_TYPES: () => GRANT_REVOCATION_TYPES,
SERVER_REGISTRATION_TYPES: () => SERVER_REGISTRATION_TYPES,
builderRegistrationDomain: () => builderRegistrationDomain,
fileDeletionDomain: () => fileDeletionDomain,
fileRegistrationDomain: () => fileRegistrationDomain,
grantRegistrationDomain: () => grantRegistrationDomain,
grantRevocationDomain: () => grantRevocationDomain,
serverRegistrationDomain: () => serverRegistrationDomain
});
module.exports = __toCommonJS(eip712_exports);
const DOMAIN_NAME = "Vana Data Portability";
const DOMAIN_VERSION = "1";
function buildDomain(chainId, verifyingContract) {
return {
name: DOMAIN_NAME,
version: DOMAIN_VERSION,
chainId,
verifyingContract
};
}
function fileRegistrationDomain(config) {
return buildDomain(
config.chainId,
config.contracts.dataRegistry
);
}
function fileDeletionDomain(config) {
return buildDomain(
config.chainId,
config.contracts.dataRegistry
);
}
function grantRegistrationDomain(config) {
return buildDomain(
config.chainId,
config.contracts.dataPortabilityPermissions
);
}
function grantRevocationDomain(config) {
return buildDomain(
config.chainId,
config.contracts.dataPortabilityPermissions
);
}
function serverRegistrationDomain(config) {
return buildDomain(
config.chainId,
config.contracts.dataPortabilityServer
);
}
function builderRegistrationDomain(config) {
return buildDomain(
config.chainId,
config.contracts.dataPortabilityGrantees
);
}
const FILE_REGISTRATION_TYPES = {
FileRegistration: [
{ name: "ownerAddress", type: "address" },
{ name: "url", type: "string" },
{ name: "schemaId", type: "bytes32" }
]
};
const FILE_DELETION_TYPES = {
FileDeletion: [
{ name: "ownerAddress", type: "address" },
{ name: "fileId", type: "bytes32" }
]
};
const GRANT_REGISTRATION_TYPES = {
GrantRegistration: [
{ name: "grantorAddress", type: "address" },
{ name: "granteeId", type: "bytes32" },
{ name: "grant", type: "string" },
{ name: "fileIds", type: "uint256[]" }
]
};
const GRANT_REVOCATION_TYPES = {
GrantRevocation: [
{ name: "grantorAddress", type: "address" },
{ name: "grantId", type: "bytes32" }
]
};
const SERVER_REGISTRATION_TYPES = {
ServerRegistration: [
{ name: "ownerAddress", type: "address" },
{ name: "serverAddress", type: "address" },
{ name: "publicKey", type: "string" },
{ name: "serverUrl", type: "string" }
]
};
const BUILDER_REGISTRATION_TYPES = {
BuilderRegistration: [
{ name: "ownerAddress", type: "address" },
{ name: "granteeAddress", type: "address" },
{ name: "publicKey", type: "string" },
{ name: "appUrl", type: "string" }
]
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BUILDER_REGISTRATION_TYPES,
FILE_DELETION_TYPES,
FILE_REGISTRATION_TYPES,
GRANT_REGISTRATION_TYPES,
GRANT_REVOCATION_TYPES,
SERVER_REGISTRATION_TYPES,
builderRegistrationDomain,
fileDeletionDomain,
fileRegistrationDomain,
grantRegistrationDomain,
grantRevocationDomain,
serverRegistrationDomain
});
//# sourceMappingURL=eip712.cjs.map