@magicnewton/newton-protocol-sdk 0.2.2 → 0.2.3--canary.78.18572445796.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/abis/newtonPolicyAbi.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/modules/policy/index.js +1 -1
- package/dist/es/abis/newtonPolicyAbi.js +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/modules/policy/index.js +1 -1
- package/dist/types/abis/newtonPolicyAbi.d.ts +230 -164
- package/dist/types/index.d.ts +28 -16
- package/dist/types/modules/policy/index.d.ts +80 -20
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=[{
|
|
1
|
+
"use strict";const e=[{type:"function",name:"clientToPolicyId",inputs:[{name:"",type:"address",internalType:"address"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"entrypoint",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"factory",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getEntrypoint",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getMetadataCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getPolicyCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getPolicyConfig",inputs:[{name:"policyId",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"tuple",internalType:"struct INewtonPolicy.PolicyConfig",components:[{name:"policyParams",type:"bytes",internalType:"bytes"},{name:"expireAfter",type:"uint32",internalType:"uint32"}]}],stateMutability:"view"},{type:"function",name:"getPolicyData",inputs:[],outputs:[{name:"",type:"address[]",internalType:"address[]"}],stateMutability:"view"},{type:"function",name:"getPolicyId",inputs:[{name:"client",type:"address",internalType:"address"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"getSchemaCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_factory",type:"address",internalType:"address"},{name:"_entrypoint",type:"string",internalType:"string"},{name:"_policyCid",type:"string",internalType:"string"},{name:"_schemaCid",type:"string",internalType:"string"},{name:"_policyData",type:"address[]",internalType:"address[]"},{name:"_metadataCid",type:"string",internalType:"string"},{name:"_owner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isPolicyVerified",inputs:[],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"metadataCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"policyCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"policyData",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"schemaCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"setMetadataCid",inputs:[{name:"_metadataCid",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setPolicy",inputs:[{name:"policyConfig",type:"tuple",internalType:"struct INewtonPolicy.PolicyConfig",components:[{name:"policyParams",type:"bytes",internalType:"bytes"},{name:"expireAfter",type:"uint32",internalType:"uint32"}]}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint8",indexed:!1,internalType:"uint8"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"PolicySet",inputs:[{name:"client",type:"address",indexed:!0,internalType:"address"},{name:"policyId",type:"bytes32",indexed:!0,internalType:"bytes32"},{name:"policy",type:"tuple",indexed:!1,internalType:"struct INewtonPolicy.SetPolicyInfo",components:[{name:"policyId",type:"bytes32",internalType:"bytes32"},{name:"policyAddress",type:"address",internalType:"address"},{name:"owner",type:"address",internalType:"address"},{name:"policyCid",type:"string",internalType:"string"},{name:"schemaCid",type:"string",internalType:"string"},{name:"entrypoint",type:"string",internalType:"string"},{name:"policyConfig",type:"tuple",internalType:"struct INewtonPolicy.PolicyConfig",components:[{name:"policyParams",type:"bytes",internalType:"bytes"},{name:"expireAfter",type:"uint32",internalType:"uint32"}]},{name:"policyData",type:"address[]",internalType:"address[]"}]}],anonymous:!1},{type:"event",name:"policyMetadataCidUpdated",inputs:[{name:"metadataCid",type:"string",indexed:!1,internalType:"string"}],anonymous:!1},{type:"error",name:"InterfaceNotSupported",inputs:[]},{type:"error",name:"OnlyPolicyClient",inputs:[]}];exports.NewtonPolicyAbi=e;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=require("viem/chains"),r=require("./modules/avs/index.js"),e=require("./modules/policy/index.js");const a=l=>i=>{const c=l?.policyContractAddress,n=()=>{if(c)return c;throw new Error('Newton SDK: policyContractAddress is required. Ensure you instantiate viem client actions extension with policyContractAddress parameter. Example: newtonWalletClientActions({ policyContractAddress: "0x123..." })')};if(i?.chain?.id!==s.mainnet.id&&i?.chain?.id!==s.sepolia.id)throw new Error("Newton SDK: Invalid network specified for newtonWalletClientActions. Only mainnet and sepolia are supported");return{submitEvaluationRequest:t=>r.submitEvaluationRequest(i,t),initialize:t=>{const o=n();return e.policyWriteFunctions.initialize({walletClient:i,policyContractAddress:o,...t})},renounceOwnership:()=>{const t=n();return e.policyWriteFunctions.renounceOwnership({walletClient:i,policyContractAddress:t})},transferOwnership:t=>{const o=n();return e.policyWriteFunctions.transferOwnership({walletClient:i,policyContractAddress:o,...t})}}},d=l=>i=>{if(i?.chain?.id!==s.mainnet.id&&i?.chain?.id!==s.sepolia.id)throw new Error("Newton SDK: Invalid network specified for newtonPublicActions. Only mainnet and sepolia are supported");const c=l?.policyContractAddress,n=()=>{if(!c)throw new Error('Newton SDK: policyContractAddress is required. Ensure you instantiate viem client actions extension with policyContractAddress parameter. Example: newtonPublicClientActions({ policyContractAddress: "0x123..." })');return c};return{waitForTaskResponded:t=>r.waitForTaskResponded(i,t),getTaskResponseHash:t=>r.getTaskResponseHash(i,t),getTaskStatus:t=>r.getTaskStatus(i,t),clientToPolicyId:t=>{const o=n();return e.policyReadFunctions.clientToPolicyId({publicClient:i,policyContractAddress:o,...t})},entrypoint:()=>{const t=n();return e.policyReadFunctions.entrypoint({publicClient:i,policyContractAddress:t})},factory:()=>{const t=n();return e.policyReadFunctions.factory({publicClient:i,policyContractAddress:t})},getEntrypoint:()=>{const t=n();return e.policyReadFunctions.getEntrypoint({publicClient:i,policyContractAddress:t})},getMetadataCid:()=>{const t=n();return e.policyReadFunctions.getMetadataCid({publicClient:i,policyContractAddress:t})},getPolicyCid:()=>{const t=n();return e.policyReadFunctions.getPolicyCid({publicClient:i,policyContractAddress:t})},getPolicyConfig:t=>{const o=n();return e.policyReadFunctions.getPolicyConfig({publicClient:i,policyContractAddress:o,...t})},getPolicyData:t=>{const o=n();return e.policyReadFunctions.getPolicyData({publicClient:i,policyContractAddress:o,...t})},getPolicyId:t=>{const o=n();return e.policyReadFunctions.getPolicyId({publicClient:i,policyContractAddress:o,...t})},getSchemaCid:()=>{const t=n();return e.policyReadFunctions.getSchemaCid({publicClient:i,policyContractAddress:t})},isPolicyVerified:t=>{const o=n();return e.policyReadFunctions.isPolicyVerified({publicClient:i,policyContractAddress:o,...t})},metadataCid:()=>{const t=n();return e.policyReadFunctions.metadataCid({publicClient:i,policyContractAddress:t})},owner:()=>{const t=n();return e.policyReadFunctions.owner({publicClient:i,policyContractAddress:t})},policyCid:()=>{const t=n();return e.policyReadFunctions.policyCid({publicClient:i,policyContractAddress:t})},policyData:t=>{const o=n();return e.policyReadFunctions.policyData({publicClient:i,policyContractAddress:o,...t})},supportsInterface:t=>{const o=n();return e.policyReadFunctions.supportsInterface({publicClient:i,policyContractAddress:o,...t})},precomputePolicyId:t=>{const o=n();return e.policyReadFunctions.precomputePolicyId({publicClient:i,policyContractAddress:o,...t})}}};exports.newtonPublicClientActions=d,exports.newtonWalletClientActions=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var o=require("../../abis/newtonPolicyAbi.js"),c=require("viem");const
|
|
1
|
+
"use strict";var o=require("../../abis/newtonPolicyAbi.js"),c=require("viem");const l=async({publicClient:t,policyContractAddress:e,client:r})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"getPolicyId",args:[r]})}catch(n){throw new Error(`Newton SDK: Failed to get getPolicyId - ${n instanceof Error?n.message:"Unknown error"}`)}},w=async({publicClient:t,policyContractAddress:e,policyId:r})=>{try{const n=await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"getPolicyConfig",args:[r]}),a=c.fromHex(n.policyParams,"string");let i;try{i=JSON.parse(a)}catch{i=a}return{policyParams:i??a,policyParamsHex:n.policyParams,expireAfter:n.expireAfter}}catch(n){throw new Error(`Newton SDK: Failed to get getPolicyConfig - ${n instanceof Error?n.message:"Unknown error"}`)}},y=async({publicClient:t,policyContractAddress:e,interfaceId:r})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"supportsInterface",args:[r]})}catch(n){throw new Error(`Newton SDK: Failed to get supportsInterface - ${n instanceof Error?n.message:"Unknown error"}`)}},p=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"owner"})}catch(r){throw new Error(`Newton SDK: Failed to get owner - ${r instanceof Error?r.message:"Unknown error"}`)}},u=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"factory"})}catch(r){throw new Error(`Newton SDK: Failed to get factory - ${r instanceof Error?r.message:"Unknown error"}`)}},C=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"entrypoint"})}catch(r){throw new Error(`Newton SDK: Failed to get entrypoint - ${r instanceof Error?r.message:"Unknown error"}`)}},g=async({publicClient:t,policyContractAddress:e,client:r})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"clientToPolicyId",args:[r]})}catch(n){throw new Error(`Newton SDK: Failed to get clientToPolicyId - ${n instanceof Error?n.message:"Unknown error"}`)}},h=async({publicClient:t,policyContractAddress:e,index:r})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"policyData",args:[BigInt(r)]})}catch(n){throw new Error(`Newton SDK: Failed to get policyData - ${n instanceof Error?n.message:"Unknown error"}`)}},f=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"getEntrypoint"})}catch(r){throw new Error(`Newton SDK: Failed to get getEntrypoint - ${r instanceof Error?r.message:"Unknown error"}`)}},m=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"getMetadataCid"})}catch(r){throw new Error(`Newton SDK: Failed to get getMetadataCid - ${r instanceof Error?r.message:"Unknown error"}`)}},N=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"getPolicyCid"})}catch(r){throw new Error(`Newton SDK: Failed to get getPolicyCid - ${r instanceof Error?r.message:"Unknown error"}`)}},b=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"getPolicyData"})}catch(r){throw new Error(`Newton SDK: Failed to get getPolicyData - ${r instanceof Error?r.message:"Unknown error"}`)}},A=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"getSchemaCid"})}catch(r){throw new Error(`Newton SDK: Failed to get getSchemaCid - ${r instanceof Error?r.message:"Unknown error"}`)}},E=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"isPolicyVerified"})}catch(r){throw new Error(`Newton SDK: Failed to get isPolicyVerified - ${r instanceof Error?r.message:"Unknown error"}`)}},P=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"metadataCid"})}catch(r){throw new Error(`Newton SDK: Failed to get metadataCid - ${r instanceof Error?r.message:"Unknown error"}`)}},D=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"policyCid"})}catch(r){throw new Error(`Newton SDK: Failed to get policyCid - ${r instanceof Error?r.message:"Unknown error"}`)}},S=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:o.NewtonPolicyAbi,functionName:"schemaCid"})}catch(r){throw new Error(`Newton SDK: Failed to get schemaCid - ${r instanceof Error?r.message:"Unknown error"}`)}},k=({publicClient:t,policyContractAddress:e,...r})=>{try{const n=r.blockTimestamp||BigInt(Math.floor(Date.now()/1e3)),a={policyParams:`0x${new TextEncoder().encode(JSON.stringify(r.params)).reduce((s,d)=>s+d.toString(16).padStart(2,"0"),"")}`,expireAfter:r.expireAfter||0},i=c.encodePacked(["address","address[]","string","string","string","tuple(bytes,uint32)","uint256"],[r.client,r.policyData,r.policyUri,r.schemaUri,r.entrypoint,a,n]);return c.keccak256(i)}catch(n){throw new Error(`Newton SDK: Failed to precompute policy ID - ${n instanceof Error?n.message:"Unknown error"}`)}},F=async({walletClient:t,policyContractAddress:e,...r})=>{try{if(!t.chain)throw new Error("Newton SDK: account and chain must be set on Wallet client");const n=t.account??(await t.getAddresses())[0];return await t.writeContract({address:e,abi:o.NewtonPolicyAbi,functionName:"initialize",args:[r.factory,r.entrypoint,r.policyCid,r.schemaCid,r.policyData,r.metadataCid,r.owner],chain:t.chain,account:n})}catch(n){throw new Error(`Newton SDK: Failed to initialize - ${n instanceof Error?n.message:"Unknown error"}`)}},K=async({walletClient:t,policyContractAddress:e})=>{try{if(!t.chain)throw new Error("Newton SDK: account and chain must be set on Wallet client");const r=t.account??(await t.getAddresses())[0];return await t.writeContract({address:e,abi:o.NewtonPolicyAbi,functionName:"renounceOwnership",chain:t.chain,account:r})}catch(r){throw new Error(`Newton SDK: Failed to renounce ownership - ${r instanceof Error?r.message:"Unknown error"}`)}},U=async({walletClient:t,policyContractAddress:e,...r})=>{try{if(!t.chain)throw new Error("Newton SDK: account and chain must be set on Wallet client");const n=t.account??(await t.getAddresses())[0];return await t.writeContract({address:e,abi:o.NewtonPolicyAbi,functionName:"transferOwnership",args:[r.newOwner],chain:t.chain,account:n})}catch(n){throw new Error(`Newton SDK: Failed to transfer ownership - ${n instanceof Error?n.message:"Unknown error"}`)}},$={initialize:F,renounceOwnership:K,transferOwnership:U},I={getPolicyId:l,getPolicyConfig:w,supportsInterface:y,owner:p,factory:u,entrypoint:C,clientToPolicyId:g,policyData:h,getEntrypoint:f,getMetadataCid:m,getPolicyCid:N,getPolicyData:b,getSchemaCid:A,isPolicyVerified:E,metadataCid:P,policyCid:D,schemaCid:S,precomputePolicyId:k};exports.policyReadFunctions=I,exports.policyWriteFunctions=$;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=[{
|
|
1
|
+
const e=[{type:"function",name:"clientToPolicyId",inputs:[{name:"",type:"address",internalType:"address"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"entrypoint",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"factory",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getEntrypoint",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getMetadataCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getPolicyCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getPolicyConfig",inputs:[{name:"policyId",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"tuple",internalType:"struct INewtonPolicy.PolicyConfig",components:[{name:"policyParams",type:"bytes",internalType:"bytes"},{name:"expireAfter",type:"uint32",internalType:"uint32"}]}],stateMutability:"view"},{type:"function",name:"getPolicyData",inputs:[],outputs:[{name:"",type:"address[]",internalType:"address[]"}],stateMutability:"view"},{type:"function",name:"getPolicyId",inputs:[{name:"client",type:"address",internalType:"address"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"getSchemaCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_factory",type:"address",internalType:"address"},{name:"_entrypoint",type:"string",internalType:"string"},{name:"_policyCid",type:"string",internalType:"string"},{name:"_schemaCid",type:"string",internalType:"string"},{name:"_policyData",type:"address[]",internalType:"address[]"},{name:"_metadataCid",type:"string",internalType:"string"},{name:"_owner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isPolicyVerified",inputs:[],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"metadataCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"policyCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"policyData",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"schemaCid",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"setMetadataCid",inputs:[{name:"_metadataCid",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setPolicy",inputs:[{name:"policyConfig",type:"tuple",internalType:"struct INewtonPolicy.PolicyConfig",components:[{name:"policyParams",type:"bytes",internalType:"bytes"},{name:"expireAfter",type:"uint32",internalType:"uint32"}]}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint8",indexed:!1,internalType:"uint8"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"PolicySet",inputs:[{name:"client",type:"address",indexed:!0,internalType:"address"},{name:"policyId",type:"bytes32",indexed:!0,internalType:"bytes32"},{name:"policy",type:"tuple",indexed:!1,internalType:"struct INewtonPolicy.SetPolicyInfo",components:[{name:"policyId",type:"bytes32",internalType:"bytes32"},{name:"policyAddress",type:"address",internalType:"address"},{name:"owner",type:"address",internalType:"address"},{name:"policyCid",type:"string",internalType:"string"},{name:"schemaCid",type:"string",internalType:"string"},{name:"entrypoint",type:"string",internalType:"string"},{name:"policyConfig",type:"tuple",internalType:"struct INewtonPolicy.PolicyConfig",components:[{name:"policyParams",type:"bytes",internalType:"bytes"},{name:"expireAfter",type:"uint32",internalType:"uint32"}]},{name:"policyData",type:"address[]",internalType:"address[]"}]}],anonymous:!1},{type:"event",name:"policyMetadataCidUpdated",inputs:[{name:"metadataCid",type:"string",indexed:!1,internalType:"string"}],anonymous:!1},{type:"error",name:"InterfaceNotSupported",inputs:[]},{type:"error",name:"OnlyPolicyClient",inputs:[]}];export{e as NewtonPolicyAbi};
|
package/dist/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mainnet as l,sepolia as a}from"viem/chains";import{getTaskStatus as
|
|
1
|
+
import{mainnet as l,sepolia as a}from"viem/chains";import{getTaskStatus as d,getTaskResponseHash as p,waitForTaskResponded as u,submitEvaluationRequest as C}from"./modules/avs/index.js";import{policyReadFunctions as o,policyWriteFunctions as s}from"./modules/policy/index.js";const y=r=>e=>{const c=r?.policyContractAddress,n=()=>{if(c)return c;throw new Error('Newton SDK: policyContractAddress is required. Ensure you instantiate viem client actions extension with policyContractAddress parameter. Example: newtonWalletClientActions({ policyContractAddress: "0x123..." })')};if(e?.chain?.id!==l.id&&e?.chain?.id!==a.id)throw new Error("Newton SDK: Invalid network specified for newtonWalletClientActions. Only mainnet and sepolia are supported");return{submitEvaluationRequest:t=>C(e,t),initialize:t=>{const i=n();return s.initialize({walletClient:e,policyContractAddress:i,...t})},renounceOwnership:()=>{const t=n();return s.renounceOwnership({walletClient:e,policyContractAddress:t})},transferOwnership:t=>{const i=n();return s.transferOwnership({walletClient:e,policyContractAddress:i,...t})}}},A=r=>e=>{if(e?.chain?.id!==l.id&&e?.chain?.id!==a.id)throw new Error("Newton SDK: Invalid network specified for newtonPublicActions. Only mainnet and sepolia are supported");const c=r?.policyContractAddress,n=()=>{if(!c)throw new Error('Newton SDK: policyContractAddress is required. Ensure you instantiate viem client actions extension with policyContractAddress parameter. Example: newtonPublicClientActions({ policyContractAddress: "0x123..." })');return c};return{waitForTaskResponded:t=>u(e,t),getTaskResponseHash:t=>p(e,t),getTaskStatus:t=>d(e,t),clientToPolicyId:t=>{const i=n();return o.clientToPolicyId({publicClient:e,policyContractAddress:i,...t})},entrypoint:()=>{const t=n();return o.entrypoint({publicClient:e,policyContractAddress:t})},factory:()=>{const t=n();return o.factory({publicClient:e,policyContractAddress:t})},getEntrypoint:()=>{const t=n();return o.getEntrypoint({publicClient:e,policyContractAddress:t})},getMetadataCid:()=>{const t=n();return o.getMetadataCid({publicClient:e,policyContractAddress:t})},getPolicyCid:()=>{const t=n();return o.getPolicyCid({publicClient:e,policyContractAddress:t})},getPolicyConfig:t=>{const i=n();return o.getPolicyConfig({publicClient:e,policyContractAddress:i,...t})},getPolicyData:t=>{const i=n();return o.getPolicyData({publicClient:e,policyContractAddress:i,...t})},getPolicyId:t=>{const i=n();return o.getPolicyId({publicClient:e,policyContractAddress:i,...t})},getSchemaCid:()=>{const t=n();return o.getSchemaCid({publicClient:e,policyContractAddress:t})},isPolicyVerified:t=>{const i=n();return o.isPolicyVerified({publicClient:e,policyContractAddress:i,...t})},metadataCid:()=>{const t=n();return o.metadataCid({publicClient:e,policyContractAddress:t})},owner:()=>{const t=n();return o.owner({publicClient:e,policyContractAddress:t})},policyCid:()=>{const t=n();return o.policyCid({publicClient:e,policyContractAddress:t})},policyData:t=>{const i=n();return o.policyData({publicClient:e,policyContractAddress:i,...t})},supportsInterface:t=>{const i=n();return o.supportsInterface({publicClient:e,policyContractAddress:i,...t})},precomputePolicyId:t=>{const i=n();return o.precomputePolicyId({publicClient:e,policyContractAddress:i,...t})}}};export{A as newtonPublicClientActions,y as newtonWalletClientActions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NewtonPolicyAbi as
|
|
1
|
+
import{NewtonPolicyAbi as a}from"../../abis/newtonPolicyAbi.js";import{encodePacked as d,keccak256 as l,fromHex as w}from"viem";const y=async({publicClient:t,policyContractAddress:e,client:r})=>{try{return await t.readContract({address:e,abi:a,functionName:"getPolicyId",args:[r]})}catch(n){throw new Error(`Newton SDK: Failed to get getPolicyId - ${n instanceof Error?n.message:"Unknown error"}`)}},p=async({publicClient:t,policyContractAddress:e,policyId:r})=>{try{const n=await t.readContract({address:e,abi:a,functionName:"getPolicyConfig",args:[r]}),o=w(n.policyParams,"string");let i;try{i=JSON.parse(o)}catch{i=o}return{policyParams:i??o,policyParamsHex:n.policyParams,expireAfter:n.expireAfter}}catch(n){throw new Error(`Newton SDK: Failed to get getPolicyConfig - ${n instanceof Error?n.message:"Unknown error"}`)}},C=async({publicClient:t,policyContractAddress:e,interfaceId:r})=>{try{return await t.readContract({address:e,abi:a,functionName:"supportsInterface",args:[r]})}catch(n){throw new Error(`Newton SDK: Failed to get supportsInterface - ${n instanceof Error?n.message:"Unknown error"}`)}},u=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"owner"})}catch(r){throw new Error(`Newton SDK: Failed to get owner - ${r instanceof Error?r.message:"Unknown error"}`)}},g=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"factory"})}catch(r){throw new Error(`Newton SDK: Failed to get factory - ${r instanceof Error?r.message:"Unknown error"}`)}},h=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"entrypoint"})}catch(r){throw new Error(`Newton SDK: Failed to get entrypoint - ${r instanceof Error?r.message:"Unknown error"}`)}},m=async({publicClient:t,policyContractAddress:e,client:r})=>{try{return await t.readContract({address:e,abi:a,functionName:"clientToPolicyId",args:[r]})}catch(n){throw new Error(`Newton SDK: Failed to get clientToPolicyId - ${n instanceof Error?n.message:"Unknown error"}`)}},f=async({publicClient:t,policyContractAddress:e,index:r})=>{try{return await t.readContract({address:e,abi:a,functionName:"policyData",args:[BigInt(r)]})}catch(n){throw new Error(`Newton SDK: Failed to get policyData - ${n instanceof Error?n.message:"Unknown error"}`)}},E=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"getEntrypoint"})}catch(r){throw new Error(`Newton SDK: Failed to get getEntrypoint - ${r instanceof Error?r.message:"Unknown error"}`)}},N=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"getMetadataCid"})}catch(r){throw new Error(`Newton SDK: Failed to get getMetadataCid - ${r instanceof Error?r.message:"Unknown error"}`)}},b=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"getPolicyCid"})}catch(r){throw new Error(`Newton SDK: Failed to get getPolicyCid - ${r instanceof Error?r.message:"Unknown error"}`)}},D=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"getPolicyData"})}catch(r){throw new Error(`Newton SDK: Failed to get getPolicyData - ${r instanceof Error?r.message:"Unknown error"}`)}},S=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"getSchemaCid"})}catch(r){throw new Error(`Newton SDK: Failed to get getSchemaCid - ${r instanceof Error?r.message:"Unknown error"}`)}},A=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"isPolicyVerified"})}catch(r){throw new Error(`Newton SDK: Failed to get isPolicyVerified - ${r instanceof Error?r.message:"Unknown error"}`)}},P=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"metadataCid"})}catch(r){throw new Error(`Newton SDK: Failed to get metadataCid - ${r instanceof Error?r.message:"Unknown error"}`)}},k=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"policyCid"})}catch(r){throw new Error(`Newton SDK: Failed to get policyCid - ${r instanceof Error?r.message:"Unknown error"}`)}},K=async({publicClient:t,policyContractAddress:e})=>{try{return await t.readContract({address:e,abi:a,functionName:"schemaCid"})}catch(r){throw new Error(`Newton SDK: Failed to get schemaCid - ${r instanceof Error?r.message:"Unknown error"}`)}},F=({publicClient:t,policyContractAddress:e,...r})=>{try{const n=r.blockTimestamp||BigInt(Math.floor(Date.now()/1e3)),o={policyParams:`0x${new TextEncoder().encode(JSON.stringify(r.params)).reduce((c,s)=>c+s.toString(16).padStart(2,"0"),"")}`,expireAfter:r.expireAfter||0},i=d(["address","address[]","string","string","string","tuple(bytes,uint32)","uint256"],[r.client,r.policyData,r.policyUri,r.schemaUri,r.entrypoint,o,n]);return l(i)}catch(n){throw new Error(`Newton SDK: Failed to precompute policy ID - ${n instanceof Error?n.message:"Unknown error"}`)}},U=async({walletClient:t,policyContractAddress:e,...r})=>{try{if(!t.chain)throw new Error("Newton SDK: account and chain must be set on Wallet client");const n=t.account??(await t.getAddresses())[0];return await t.writeContract({address:e,abi:a,functionName:"initialize",args:[r.factory,r.entrypoint,r.policyCid,r.schemaCid,r.policyData,r.metadataCid,r.owner],chain:t.chain,account:n})}catch(n){throw new Error(`Newton SDK: Failed to initialize - ${n instanceof Error?n.message:"Unknown error"}`)}},$=async({walletClient:t,policyContractAddress:e})=>{try{if(!t.chain)throw new Error("Newton SDK: account and chain must be set on Wallet client");const r=t.account??(await t.getAddresses())[0];return await t.writeContract({address:e,abi:a,functionName:"renounceOwnership",chain:t.chain,account:r})}catch(r){throw new Error(`Newton SDK: Failed to renounce ownership - ${r instanceof Error?r.message:"Unknown error"}`)}},I=async({walletClient:t,policyContractAddress:e,...r})=>{try{if(!t.chain)throw new Error("Newton SDK: account and chain must be set on Wallet client");const n=t.account??(await t.getAddresses())[0];return await t.writeContract({address:e,abi:a,functionName:"transferOwnership",args:[r.newOwner],chain:t.chain,account:n})}catch(n){throw new Error(`Newton SDK: Failed to transfer ownership - ${n instanceof Error?n.message:"Unknown error"}`)}},x={initialize:U,renounceOwnership:$,transferOwnership:I},O={getPolicyId:y,getPolicyConfig:p,supportsInterface:C,owner:u,factory:g,entrypoint:h,clientToPolicyId:m,policyData:f,getEntrypoint:E,getMetadataCid:N,getPolicyCid:b,getPolicyData:D,getSchemaCid:S,isPolicyVerified:A,metadataCid:P,policyCid:k,schemaCid:K,precomputePolicyId:F};export{O as policyReadFunctions,x as policyWriteFunctions};
|
|
@@ -1,322 +1,388 @@
|
|
|
1
1
|
export declare const NewtonPolicyAbi: readonly [{
|
|
2
|
-
readonly
|
|
3
|
-
readonly name: "
|
|
4
|
-
readonly type: "error";
|
|
5
|
-
}, {
|
|
6
|
-
readonly inputs: readonly [];
|
|
7
|
-
readonly name: "OnlyPolicyClient";
|
|
8
|
-
readonly type: "error";
|
|
9
|
-
}, {
|
|
10
|
-
readonly anonymous: false;
|
|
11
|
-
readonly inputs: readonly [{
|
|
12
|
-
readonly indexed: false;
|
|
13
|
-
readonly internalType: "uint8";
|
|
14
|
-
readonly name: "version";
|
|
15
|
-
readonly type: "uint8";
|
|
16
|
-
}];
|
|
17
|
-
readonly name: "Initialized";
|
|
18
|
-
readonly type: "event";
|
|
19
|
-
}, {
|
|
20
|
-
readonly anonymous: false;
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "clientToPolicyId";
|
|
21
4
|
readonly inputs: readonly [{
|
|
22
|
-
readonly
|
|
23
|
-
readonly internalType: "address";
|
|
24
|
-
readonly name: "previousOwner";
|
|
5
|
+
readonly name: "";
|
|
25
6
|
readonly type: "address";
|
|
26
|
-
}, {
|
|
27
|
-
readonly indexed: true;
|
|
28
7
|
readonly internalType: "address";
|
|
29
|
-
readonly name: "newOwner";
|
|
30
|
-
readonly type: "address";
|
|
31
8
|
}];
|
|
32
|
-
readonly
|
|
33
|
-
|
|
34
|
-
}, {
|
|
35
|
-
readonly anonymous: false;
|
|
36
|
-
readonly inputs: readonly [{
|
|
37
|
-
readonly indexed: true;
|
|
38
|
-
readonly internalType: "address";
|
|
39
|
-
readonly name: "client";
|
|
40
|
-
readonly type: "address";
|
|
41
|
-
}, {
|
|
42
|
-
readonly indexed: true;
|
|
43
|
-
readonly internalType: "bytes32";
|
|
44
|
-
readonly name: "policyId";
|
|
9
|
+
readonly outputs: readonly [{
|
|
10
|
+
readonly name: "";
|
|
45
11
|
readonly type: "bytes32";
|
|
46
|
-
|
|
47
|
-
readonly components: readonly [{
|
|
48
|
-
readonly internalType: "bytes32";
|
|
49
|
-
readonly name: "policyId";
|
|
50
|
-
readonly type: "bytes32";
|
|
51
|
-
}, {
|
|
52
|
-
readonly internalType: "string";
|
|
53
|
-
readonly name: "policyUri";
|
|
54
|
-
readonly type: "string";
|
|
55
|
-
}, {
|
|
56
|
-
readonly internalType: "string";
|
|
57
|
-
readonly name: "schemaUri";
|
|
58
|
-
readonly type: "string";
|
|
59
|
-
}, {
|
|
60
|
-
readonly internalType: "string";
|
|
61
|
-
readonly name: "entrypoint";
|
|
62
|
-
readonly type: "string";
|
|
63
|
-
}, {
|
|
64
|
-
readonly components: readonly [{
|
|
65
|
-
readonly internalType: "bytes";
|
|
66
|
-
readonly name: "policyParams";
|
|
67
|
-
readonly type: "bytes";
|
|
68
|
-
}, {
|
|
69
|
-
readonly internalType: "uint32";
|
|
70
|
-
readonly name: "expireAfter";
|
|
71
|
-
readonly type: "uint32";
|
|
72
|
-
}];
|
|
73
|
-
readonly internalType: "struct INewtonPolicy.PolicyConfig";
|
|
74
|
-
readonly name: "policyConfig";
|
|
75
|
-
readonly type: "tuple";
|
|
76
|
-
}, {
|
|
77
|
-
readonly internalType: "address[]";
|
|
78
|
-
readonly name: "policyData";
|
|
79
|
-
readonly type: "address[]";
|
|
80
|
-
}];
|
|
81
|
-
readonly indexed: false;
|
|
82
|
-
readonly internalType: "struct INewtonPolicy.Policy";
|
|
83
|
-
readonly name: "policy";
|
|
84
|
-
readonly type: "tuple";
|
|
12
|
+
readonly internalType: "bytes32";
|
|
85
13
|
}];
|
|
86
|
-
readonly
|
|
87
|
-
readonly type: "event";
|
|
14
|
+
readonly stateMutability: "view";
|
|
88
15
|
}, {
|
|
89
|
-
readonly
|
|
90
|
-
|
|
16
|
+
readonly type: "function";
|
|
17
|
+
readonly name: "entrypoint";
|
|
18
|
+
readonly inputs: readonly [];
|
|
19
|
+
readonly outputs: readonly [{
|
|
91
20
|
readonly name: "";
|
|
92
|
-
readonly type: "
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
readonly internalType: "string";
|
|
93
23
|
}];
|
|
94
|
-
readonly
|
|
24
|
+
readonly stateMutability: "view";
|
|
25
|
+
}, {
|
|
26
|
+
readonly type: "function";
|
|
27
|
+
readonly name: "factory";
|
|
28
|
+
readonly inputs: readonly [];
|
|
95
29
|
readonly outputs: readonly [{
|
|
96
|
-
readonly internalType: "bytes32";
|
|
97
30
|
readonly name: "";
|
|
98
|
-
readonly type: "
|
|
31
|
+
readonly type: "address";
|
|
32
|
+
readonly internalType: "address";
|
|
99
33
|
}];
|
|
100
34
|
readonly stateMutability: "view";
|
|
101
|
-
readonly type: "function";
|
|
102
35
|
}, {
|
|
36
|
+
readonly type: "function";
|
|
37
|
+
readonly name: "getEntrypoint";
|
|
103
38
|
readonly inputs: readonly [];
|
|
104
|
-
readonly name: "entrypoint";
|
|
105
39
|
readonly outputs: readonly [{
|
|
106
|
-
readonly internalType: "string";
|
|
107
40
|
readonly name: "";
|
|
108
41
|
readonly type: "string";
|
|
42
|
+
readonly internalType: "string";
|
|
109
43
|
}];
|
|
110
44
|
readonly stateMutability: "view";
|
|
111
|
-
readonly type: "function";
|
|
112
45
|
}, {
|
|
46
|
+
readonly type: "function";
|
|
47
|
+
readonly name: "getMetadataCid";
|
|
113
48
|
readonly inputs: readonly [];
|
|
114
|
-
readonly name: "factory";
|
|
115
49
|
readonly outputs: readonly [{
|
|
116
|
-
readonly internalType: "address";
|
|
117
50
|
readonly name: "";
|
|
118
|
-
readonly type: "
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly internalType: "string";
|
|
119
53
|
}];
|
|
120
54
|
readonly stateMutability: "view";
|
|
121
|
-
readonly type: "function";
|
|
122
55
|
}, {
|
|
56
|
+
readonly type: "function";
|
|
57
|
+
readonly name: "getPolicyCid";
|
|
123
58
|
readonly inputs: readonly [];
|
|
124
|
-
readonly name: "getEntrypoint";
|
|
125
59
|
readonly outputs: readonly [{
|
|
126
|
-
readonly internalType: "string";
|
|
127
60
|
readonly name: "";
|
|
128
61
|
readonly type: "string";
|
|
62
|
+
readonly internalType: "string";
|
|
129
63
|
}];
|
|
130
64
|
readonly stateMutability: "view";
|
|
131
|
-
readonly type: "function";
|
|
132
65
|
}, {
|
|
66
|
+
readonly type: "function";
|
|
67
|
+
readonly name: "getPolicyConfig";
|
|
133
68
|
readonly inputs: readonly [{
|
|
134
|
-
readonly internalType: "bytes32";
|
|
135
69
|
readonly name: "policyId";
|
|
136
70
|
readonly type: "bytes32";
|
|
71
|
+
readonly internalType: "bytes32";
|
|
137
72
|
}];
|
|
138
|
-
readonly name: "getPolicyConfig";
|
|
139
73
|
readonly outputs: readonly [{
|
|
74
|
+
readonly name: "";
|
|
75
|
+
readonly type: "tuple";
|
|
76
|
+
readonly internalType: "struct INewtonPolicy.PolicyConfig";
|
|
140
77
|
readonly components: readonly [{
|
|
141
|
-
readonly internalType: "bytes";
|
|
142
78
|
readonly name: "policyParams";
|
|
143
79
|
readonly type: "bytes";
|
|
80
|
+
readonly internalType: "bytes";
|
|
144
81
|
}, {
|
|
145
|
-
readonly internalType: "uint32";
|
|
146
82
|
readonly name: "expireAfter";
|
|
147
83
|
readonly type: "uint32";
|
|
84
|
+
readonly internalType: "uint32";
|
|
148
85
|
}];
|
|
149
|
-
readonly internalType: "struct INewtonPolicy.PolicyConfig";
|
|
150
|
-
readonly name: "";
|
|
151
|
-
readonly type: "tuple";
|
|
152
86
|
}];
|
|
153
87
|
readonly stateMutability: "view";
|
|
154
|
-
readonly type: "function";
|
|
155
88
|
}, {
|
|
156
|
-
readonly
|
|
89
|
+
readonly type: "function";
|
|
157
90
|
readonly name: "getPolicyData";
|
|
91
|
+
readonly inputs: readonly [];
|
|
158
92
|
readonly outputs: readonly [{
|
|
159
|
-
readonly internalType: "address[]";
|
|
160
93
|
readonly name: "";
|
|
161
94
|
readonly type: "address[]";
|
|
95
|
+
readonly internalType: "address[]";
|
|
162
96
|
}];
|
|
163
97
|
readonly stateMutability: "view";
|
|
164
|
-
readonly type: "function";
|
|
165
98
|
}, {
|
|
99
|
+
readonly type: "function";
|
|
100
|
+
readonly name: "getPolicyId";
|
|
166
101
|
readonly inputs: readonly [{
|
|
167
|
-
readonly internalType: "address";
|
|
168
102
|
readonly name: "client";
|
|
169
103
|
readonly type: "address";
|
|
104
|
+
readonly internalType: "address";
|
|
170
105
|
}];
|
|
171
|
-
readonly name: "getPolicyId";
|
|
172
106
|
readonly outputs: readonly [{
|
|
173
|
-
readonly internalType: "bytes32";
|
|
174
107
|
readonly name: "";
|
|
175
108
|
readonly type: "bytes32";
|
|
109
|
+
readonly internalType: "bytes32";
|
|
176
110
|
}];
|
|
177
111
|
readonly stateMutability: "view";
|
|
178
|
-
readonly type: "function";
|
|
179
112
|
}, {
|
|
180
|
-
readonly inputs: readonly [];
|
|
181
|
-
readonly name: "getPolicyUri";
|
|
182
|
-
readonly outputs: readonly [{
|
|
183
|
-
readonly internalType: "string";
|
|
184
|
-
readonly name: "";
|
|
185
|
-
readonly type: "string";
|
|
186
|
-
}];
|
|
187
|
-
readonly stateMutability: "view";
|
|
188
113
|
readonly type: "function";
|
|
189
|
-
|
|
114
|
+
readonly name: "getSchemaCid";
|
|
190
115
|
readonly inputs: readonly [];
|
|
191
|
-
readonly name: "getSchemaUri";
|
|
192
116
|
readonly outputs: readonly [{
|
|
193
|
-
readonly internalType: "string";
|
|
194
117
|
readonly name: "";
|
|
195
118
|
readonly type: "string";
|
|
119
|
+
readonly internalType: "string";
|
|
196
120
|
}];
|
|
197
121
|
readonly stateMutability: "view";
|
|
198
|
-
readonly type: "function";
|
|
199
122
|
}, {
|
|
123
|
+
readonly type: "function";
|
|
124
|
+
readonly name: "initialize";
|
|
200
125
|
readonly inputs: readonly [{
|
|
201
|
-
readonly internalType: "address";
|
|
202
126
|
readonly name: "_factory";
|
|
203
127
|
readonly type: "address";
|
|
128
|
+
readonly internalType: "address";
|
|
204
129
|
}, {
|
|
205
|
-
readonly internalType: "string";
|
|
206
130
|
readonly name: "_entrypoint";
|
|
207
131
|
readonly type: "string";
|
|
208
|
-
}, {
|
|
209
132
|
readonly internalType: "string";
|
|
210
|
-
readonly name: "_policyUri";
|
|
211
|
-
readonly type: "string";
|
|
212
133
|
}, {
|
|
134
|
+
readonly name: "_policyCid";
|
|
135
|
+
readonly type: "string";
|
|
213
136
|
readonly internalType: "string";
|
|
214
|
-
|
|
137
|
+
}, {
|
|
138
|
+
readonly name: "_schemaCid";
|
|
215
139
|
readonly type: "string";
|
|
140
|
+
readonly internalType: "string";
|
|
216
141
|
}, {
|
|
217
|
-
readonly internalType: "address[]";
|
|
218
142
|
readonly name: "_policyData";
|
|
219
143
|
readonly type: "address[]";
|
|
144
|
+
readonly internalType: "address[]";
|
|
145
|
+
}, {
|
|
146
|
+
readonly name: "_metadataCid";
|
|
147
|
+
readonly type: "string";
|
|
148
|
+
readonly internalType: "string";
|
|
149
|
+
}, {
|
|
150
|
+
readonly name: "_owner";
|
|
151
|
+
readonly type: "address";
|
|
152
|
+
readonly internalType: "address";
|
|
220
153
|
}];
|
|
221
|
-
readonly name: "initialize";
|
|
222
154
|
readonly outputs: readonly [];
|
|
223
155
|
readonly stateMutability: "nonpayable";
|
|
224
|
-
readonly type: "function";
|
|
225
156
|
}, {
|
|
157
|
+
readonly type: "function";
|
|
158
|
+
readonly name: "isPolicyVerified";
|
|
226
159
|
readonly inputs: readonly [];
|
|
227
|
-
readonly name: "owner";
|
|
228
160
|
readonly outputs: readonly [{
|
|
229
|
-
readonly internalType: "address";
|
|
230
161
|
readonly name: "";
|
|
231
|
-
readonly type: "
|
|
162
|
+
readonly type: "bool";
|
|
163
|
+
readonly internalType: "bool";
|
|
232
164
|
}];
|
|
233
165
|
readonly stateMutability: "view";
|
|
234
|
-
readonly type: "function";
|
|
235
166
|
}, {
|
|
236
|
-
readonly
|
|
237
|
-
|
|
167
|
+
readonly type: "function";
|
|
168
|
+
readonly name: "metadataCid";
|
|
169
|
+
readonly inputs: readonly [];
|
|
170
|
+
readonly outputs: readonly [{
|
|
238
171
|
readonly name: "";
|
|
239
|
-
readonly type: "
|
|
172
|
+
readonly type: "string";
|
|
173
|
+
readonly internalType: "string";
|
|
240
174
|
}];
|
|
241
|
-
readonly
|
|
175
|
+
readonly stateMutability: "view";
|
|
176
|
+
}, {
|
|
177
|
+
readonly type: "function";
|
|
178
|
+
readonly name: "owner";
|
|
179
|
+
readonly inputs: readonly [];
|
|
242
180
|
readonly outputs: readonly [{
|
|
243
|
-
readonly internalType: "address";
|
|
244
181
|
readonly name: "";
|
|
245
182
|
readonly type: "address";
|
|
183
|
+
readonly internalType: "address";
|
|
246
184
|
}];
|
|
247
185
|
readonly stateMutability: "view";
|
|
248
|
-
readonly type: "function";
|
|
249
186
|
}, {
|
|
187
|
+
readonly type: "function";
|
|
188
|
+
readonly name: "policyCid";
|
|
250
189
|
readonly inputs: readonly [];
|
|
251
|
-
readonly name: "policyUri";
|
|
252
190
|
readonly outputs: readonly [{
|
|
253
|
-
readonly internalType: "string";
|
|
254
191
|
readonly name: "";
|
|
255
192
|
readonly type: "string";
|
|
193
|
+
readonly internalType: "string";
|
|
256
194
|
}];
|
|
257
195
|
readonly stateMutability: "view";
|
|
196
|
+
}, {
|
|
258
197
|
readonly type: "function";
|
|
198
|
+
readonly name: "policyData";
|
|
199
|
+
readonly inputs: readonly [{
|
|
200
|
+
readonly name: "";
|
|
201
|
+
readonly type: "uint256";
|
|
202
|
+
readonly internalType: "uint256";
|
|
203
|
+
}];
|
|
204
|
+
readonly outputs: readonly [{
|
|
205
|
+
readonly name: "";
|
|
206
|
+
readonly type: "address";
|
|
207
|
+
readonly internalType: "address";
|
|
208
|
+
}];
|
|
209
|
+
readonly stateMutability: "view";
|
|
259
210
|
}, {
|
|
260
|
-
readonly
|
|
211
|
+
readonly type: "function";
|
|
261
212
|
readonly name: "renounceOwnership";
|
|
213
|
+
readonly inputs: readonly [];
|
|
262
214
|
readonly outputs: readonly [];
|
|
263
215
|
readonly stateMutability: "nonpayable";
|
|
264
|
-
readonly type: "function";
|
|
265
216
|
}, {
|
|
217
|
+
readonly type: "function";
|
|
218
|
+
readonly name: "schemaCid";
|
|
266
219
|
readonly inputs: readonly [];
|
|
267
|
-
readonly name: "schemaUri";
|
|
268
220
|
readonly outputs: readonly [{
|
|
269
|
-
readonly internalType: "string";
|
|
270
221
|
readonly name: "";
|
|
271
222
|
readonly type: "string";
|
|
223
|
+
readonly internalType: "string";
|
|
272
224
|
}];
|
|
273
225
|
readonly stateMutability: "view";
|
|
226
|
+
}, {
|
|
274
227
|
readonly type: "function";
|
|
228
|
+
readonly name: "setMetadataCid";
|
|
229
|
+
readonly inputs: readonly [{
|
|
230
|
+
readonly name: "_metadataCid";
|
|
231
|
+
readonly type: "string";
|
|
232
|
+
readonly internalType: "string";
|
|
233
|
+
}];
|
|
234
|
+
readonly outputs: readonly [];
|
|
235
|
+
readonly stateMutability: "nonpayable";
|
|
275
236
|
}, {
|
|
237
|
+
readonly type: "function";
|
|
238
|
+
readonly name: "setPolicy";
|
|
276
239
|
readonly inputs: readonly [{
|
|
240
|
+
readonly name: "policyConfig";
|
|
241
|
+
readonly type: "tuple";
|
|
242
|
+
readonly internalType: "struct INewtonPolicy.PolicyConfig";
|
|
277
243
|
readonly components: readonly [{
|
|
278
|
-
readonly internalType: "bytes";
|
|
279
244
|
readonly name: "policyParams";
|
|
280
245
|
readonly type: "bytes";
|
|
246
|
+
readonly internalType: "bytes";
|
|
281
247
|
}, {
|
|
282
|
-
readonly internalType: "uint32";
|
|
283
248
|
readonly name: "expireAfter";
|
|
284
249
|
readonly type: "uint32";
|
|
250
|
+
readonly internalType: "uint32";
|
|
285
251
|
}];
|
|
286
|
-
readonly internalType: "struct INewtonPolicy.PolicyConfig";
|
|
287
|
-
readonly name: "policyConfig";
|
|
288
|
-
readonly type: "tuple";
|
|
289
252
|
}];
|
|
290
|
-
readonly name: "setPolicy";
|
|
291
253
|
readonly outputs: readonly [{
|
|
292
|
-
readonly internalType: "bytes32";
|
|
293
254
|
readonly name: "";
|
|
294
255
|
readonly type: "bytes32";
|
|
256
|
+
readonly internalType: "bytes32";
|
|
295
257
|
}];
|
|
296
258
|
readonly stateMutability: "nonpayable";
|
|
297
|
-
readonly type: "function";
|
|
298
259
|
}, {
|
|
260
|
+
readonly type: "function";
|
|
261
|
+
readonly name: "supportsInterface";
|
|
299
262
|
readonly inputs: readonly [{
|
|
300
|
-
readonly internalType: "bytes4";
|
|
301
263
|
readonly name: "interfaceId";
|
|
302
264
|
readonly type: "bytes4";
|
|
265
|
+
readonly internalType: "bytes4";
|
|
303
266
|
}];
|
|
304
|
-
readonly name: "supportsInterface";
|
|
305
267
|
readonly outputs: readonly [{
|
|
306
|
-
readonly internalType: "bool";
|
|
307
268
|
readonly name: "";
|
|
308
269
|
readonly type: "bool";
|
|
270
|
+
readonly internalType: "bool";
|
|
309
271
|
}];
|
|
310
272
|
readonly stateMutability: "view";
|
|
311
|
-
readonly type: "function";
|
|
312
273
|
}, {
|
|
274
|
+
readonly type: "function";
|
|
275
|
+
readonly name: "transferOwnership";
|
|
313
276
|
readonly inputs: readonly [{
|
|
314
|
-
readonly internalType: "address";
|
|
315
277
|
readonly name: "newOwner";
|
|
316
278
|
readonly type: "address";
|
|
279
|
+
readonly internalType: "address";
|
|
317
280
|
}];
|
|
318
|
-
readonly name: "transferOwnership";
|
|
319
281
|
readonly outputs: readonly [];
|
|
320
282
|
readonly stateMutability: "nonpayable";
|
|
321
|
-
|
|
283
|
+
}, {
|
|
284
|
+
readonly type: "event";
|
|
285
|
+
readonly name: "Initialized";
|
|
286
|
+
readonly inputs: readonly [{
|
|
287
|
+
readonly name: "version";
|
|
288
|
+
readonly type: "uint8";
|
|
289
|
+
readonly indexed: false;
|
|
290
|
+
readonly internalType: "uint8";
|
|
291
|
+
}];
|
|
292
|
+
readonly anonymous: false;
|
|
293
|
+
}, {
|
|
294
|
+
readonly type: "event";
|
|
295
|
+
readonly name: "OwnershipTransferred";
|
|
296
|
+
readonly inputs: readonly [{
|
|
297
|
+
readonly name: "previousOwner";
|
|
298
|
+
readonly type: "address";
|
|
299
|
+
readonly indexed: true;
|
|
300
|
+
readonly internalType: "address";
|
|
301
|
+
}, {
|
|
302
|
+
readonly name: "newOwner";
|
|
303
|
+
readonly type: "address";
|
|
304
|
+
readonly indexed: true;
|
|
305
|
+
readonly internalType: "address";
|
|
306
|
+
}];
|
|
307
|
+
readonly anonymous: false;
|
|
308
|
+
}, {
|
|
309
|
+
readonly type: "event";
|
|
310
|
+
readonly name: "PolicySet";
|
|
311
|
+
readonly inputs: readonly [{
|
|
312
|
+
readonly name: "client";
|
|
313
|
+
readonly type: "address";
|
|
314
|
+
readonly indexed: true;
|
|
315
|
+
readonly internalType: "address";
|
|
316
|
+
}, {
|
|
317
|
+
readonly name: "policyId";
|
|
318
|
+
readonly type: "bytes32";
|
|
319
|
+
readonly indexed: true;
|
|
320
|
+
readonly internalType: "bytes32";
|
|
321
|
+
}, {
|
|
322
|
+
readonly name: "policy";
|
|
323
|
+
readonly type: "tuple";
|
|
324
|
+
readonly indexed: false;
|
|
325
|
+
readonly internalType: "struct INewtonPolicy.SetPolicyInfo";
|
|
326
|
+
readonly components: readonly [{
|
|
327
|
+
readonly name: "policyId";
|
|
328
|
+
readonly type: "bytes32";
|
|
329
|
+
readonly internalType: "bytes32";
|
|
330
|
+
}, {
|
|
331
|
+
readonly name: "policyAddress";
|
|
332
|
+
readonly type: "address";
|
|
333
|
+
readonly internalType: "address";
|
|
334
|
+
}, {
|
|
335
|
+
readonly name: "owner";
|
|
336
|
+
readonly type: "address";
|
|
337
|
+
readonly internalType: "address";
|
|
338
|
+
}, {
|
|
339
|
+
readonly name: "policyCid";
|
|
340
|
+
readonly type: "string";
|
|
341
|
+
readonly internalType: "string";
|
|
342
|
+
}, {
|
|
343
|
+
readonly name: "schemaCid";
|
|
344
|
+
readonly type: "string";
|
|
345
|
+
readonly internalType: "string";
|
|
346
|
+
}, {
|
|
347
|
+
readonly name: "entrypoint";
|
|
348
|
+
readonly type: "string";
|
|
349
|
+
readonly internalType: "string";
|
|
350
|
+
}, {
|
|
351
|
+
readonly name: "policyConfig";
|
|
352
|
+
readonly type: "tuple";
|
|
353
|
+
readonly internalType: "struct INewtonPolicy.PolicyConfig";
|
|
354
|
+
readonly components: readonly [{
|
|
355
|
+
readonly name: "policyParams";
|
|
356
|
+
readonly type: "bytes";
|
|
357
|
+
readonly internalType: "bytes";
|
|
358
|
+
}, {
|
|
359
|
+
readonly name: "expireAfter";
|
|
360
|
+
readonly type: "uint32";
|
|
361
|
+
readonly internalType: "uint32";
|
|
362
|
+
}];
|
|
363
|
+
}, {
|
|
364
|
+
readonly name: "policyData";
|
|
365
|
+
readonly type: "address[]";
|
|
366
|
+
readonly internalType: "address[]";
|
|
367
|
+
}];
|
|
368
|
+
}];
|
|
369
|
+
readonly anonymous: false;
|
|
370
|
+
}, {
|
|
371
|
+
readonly type: "event";
|
|
372
|
+
readonly name: "policyMetadataCidUpdated";
|
|
373
|
+
readonly inputs: readonly [{
|
|
374
|
+
readonly name: "metadataCid";
|
|
375
|
+
readonly type: "string";
|
|
376
|
+
readonly indexed: false;
|
|
377
|
+
readonly internalType: "string";
|
|
378
|
+
}];
|
|
379
|
+
readonly anonymous: false;
|
|
380
|
+
}, {
|
|
381
|
+
readonly type: "error";
|
|
382
|
+
readonly name: "InterfaceNotSupported";
|
|
383
|
+
readonly inputs: readonly [];
|
|
384
|
+
}, {
|
|
385
|
+
readonly type: "error";
|
|
386
|
+
readonly name: "OnlyPolicyClient";
|
|
387
|
+
readonly inputs: readonly [];
|
|
322
388
|
}];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,9 +14,11 @@ declare const newtonWalletClientActions: (options?: {
|
|
|
14
14
|
initialize: (args: {
|
|
15
15
|
factory: Address;
|
|
16
16
|
entrypoint: string;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
policyCid: string;
|
|
18
|
+
schemaCid: string;
|
|
19
19
|
policyData: Address[];
|
|
20
|
+
metadataCid: string;
|
|
21
|
+
owner: Address;
|
|
20
22
|
}) => Promise<`0x${string}`>;
|
|
21
23
|
renounceOwnership: () => Promise<`0x${string}`>;
|
|
22
24
|
transferOwnership: (args: {
|
|
@@ -37,23 +39,14 @@ declare const newtonPublicClientActions: (options?: {
|
|
|
37
39
|
getTaskStatus: (args: {
|
|
38
40
|
taskId: TaskId;
|
|
39
41
|
}) => Promise<TaskStatus>;
|
|
40
|
-
policyUri: () => Promise<string>;
|
|
41
|
-
supportsInterface: (args: {
|
|
42
|
-
interfaceId: `0x${string}`;
|
|
43
|
-
}) => Promise<boolean>;
|
|
44
|
-
owner: () => Promise<Address>;
|
|
45
|
-
factory: () => Promise<Address>;
|
|
46
|
-
entrypoint: () => Promise<string>;
|
|
47
|
-
schemaUri: () => Promise<string>;
|
|
48
|
-
policyData: (args: {
|
|
49
|
-
index: number;
|
|
50
|
-
}) => Promise<Address>;
|
|
51
42
|
clientToPolicyId: (args: {
|
|
52
43
|
client: Address;
|
|
53
44
|
}) => Promise<`0x${string}`>;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
entrypoint: () => Promise<string>;
|
|
46
|
+
factory: () => Promise<Address>;
|
|
47
|
+
getEntrypoint: () => Promise<string>;
|
|
48
|
+
getMetadataCid: () => Promise<string>;
|
|
49
|
+
getPolicyCid: () => Promise<string>;
|
|
57
50
|
getPolicyConfig: (args: {
|
|
58
51
|
policyId: `0x${string}`;
|
|
59
52
|
}) => Promise<{
|
|
@@ -61,6 +54,25 @@ declare const newtonPublicClientActions: (options?: {
|
|
|
61
54
|
policyParamsHex: `0x${string}`;
|
|
62
55
|
expireAfter: number;
|
|
63
56
|
}>;
|
|
57
|
+
getPolicyData: (args: {
|
|
58
|
+
index: number;
|
|
59
|
+
}) => Promise<Address[]>;
|
|
60
|
+
getPolicyId: (args: {
|
|
61
|
+
client: Address;
|
|
62
|
+
}) => Promise<`0x${string}`>;
|
|
63
|
+
getSchemaCid: () => Promise<string>;
|
|
64
|
+
isPolicyVerified: (args: {
|
|
65
|
+
client: Address;
|
|
66
|
+
}) => Promise<boolean>;
|
|
67
|
+
metadataCid: () => Promise<string>;
|
|
68
|
+
owner: () => Promise<Address>;
|
|
69
|
+
policyCid: () => Promise<string>;
|
|
70
|
+
policyData: (args: {
|
|
71
|
+
index: number;
|
|
72
|
+
}) => Promise<Address>;
|
|
73
|
+
supportsInterface: (args: {
|
|
74
|
+
interfaceId: `0x${string}`;
|
|
75
|
+
}) => Promise<boolean>;
|
|
64
76
|
precomputePolicyId: (args: {
|
|
65
77
|
policyContract: Address;
|
|
66
78
|
policyData: Address[];
|
|
@@ -6,9 +6,11 @@ export declare const policyWriteFunctions: {
|
|
|
6
6
|
policyContractAddress: Address;
|
|
7
7
|
factory: Address;
|
|
8
8
|
entrypoint: string;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
policyCid: string;
|
|
10
|
+
schemaCid: string;
|
|
11
11
|
policyData: Address[];
|
|
12
|
+
metadataCid: string;
|
|
13
|
+
owner: Address;
|
|
12
14
|
}) => Promise<`0x${string}`>;
|
|
13
15
|
renounceOwnership: ({ walletClient, policyContractAddress, }: {
|
|
14
16
|
walletClient: WalletClient;
|
|
@@ -21,10 +23,6 @@ export declare const policyWriteFunctions: {
|
|
|
21
23
|
}) => Promise<`0x${string}`>;
|
|
22
24
|
};
|
|
23
25
|
export declare const policyReadFunctions: {
|
|
24
|
-
policyUri: ({ publicClient, policyContractAddress, }: {
|
|
25
|
-
publicClient: PublicClient;
|
|
26
|
-
policyContractAddress: Address;
|
|
27
|
-
}) => Promise<string>;
|
|
28
26
|
getPolicyId: ({ publicClient, policyContractAddress, client, }: {
|
|
29
27
|
publicClient: PublicClient;
|
|
30
28
|
policyContractAddress: Address;
|
|
@@ -56,10 +54,6 @@ export declare const policyReadFunctions: {
|
|
|
56
54
|
publicClient: PublicClient;
|
|
57
55
|
policyContractAddress: Address;
|
|
58
56
|
}) => Promise<string>;
|
|
59
|
-
schemaUri: ({ publicClient, policyContractAddress, }: {
|
|
60
|
-
publicClient: PublicClient;
|
|
61
|
-
policyContractAddress: Address;
|
|
62
|
-
}) => Promise<string>;
|
|
63
57
|
clientToPolicyId: ({ publicClient, policyContractAddress, client, }: {
|
|
64
58
|
publicClient: PublicClient;
|
|
65
59
|
policyContractAddress: Address;
|
|
@@ -70,6 +64,42 @@ export declare const policyReadFunctions: {
|
|
|
70
64
|
policyContractAddress: Address;
|
|
71
65
|
index: number;
|
|
72
66
|
}) => Promise<Address>;
|
|
67
|
+
getEntrypoint: ({ publicClient, policyContractAddress, }: {
|
|
68
|
+
publicClient: PublicClient;
|
|
69
|
+
policyContractAddress: Address;
|
|
70
|
+
}) => Promise<string>;
|
|
71
|
+
getMetadataCid: ({ publicClient, policyContractAddress, }: {
|
|
72
|
+
publicClient: PublicClient;
|
|
73
|
+
policyContractAddress: Address;
|
|
74
|
+
}) => Promise<string>;
|
|
75
|
+
getPolicyCid: ({ publicClient, policyContractAddress, }: {
|
|
76
|
+
publicClient: PublicClient;
|
|
77
|
+
policyContractAddress: Address;
|
|
78
|
+
}) => Promise<string>;
|
|
79
|
+
getPolicyData: ({ publicClient, policyContractAddress, }: {
|
|
80
|
+
publicClient: PublicClient;
|
|
81
|
+
policyContractAddress: Address;
|
|
82
|
+
}) => Promise<Address[]>;
|
|
83
|
+
getSchemaCid: ({ publicClient, policyContractAddress, }: {
|
|
84
|
+
publicClient: PublicClient;
|
|
85
|
+
policyContractAddress: Address;
|
|
86
|
+
}) => Promise<string>;
|
|
87
|
+
isPolicyVerified: ({ publicClient, policyContractAddress, }: {
|
|
88
|
+
publicClient: PublicClient;
|
|
89
|
+
policyContractAddress: Address;
|
|
90
|
+
}) => Promise<boolean>;
|
|
91
|
+
metadataCid: ({ publicClient, policyContractAddress, }: {
|
|
92
|
+
publicClient: PublicClient;
|
|
93
|
+
policyContractAddress: Address;
|
|
94
|
+
}) => Promise<string>;
|
|
95
|
+
policyCid: ({ publicClient, policyContractAddress, }: {
|
|
96
|
+
publicClient: PublicClient;
|
|
97
|
+
policyContractAddress: Address;
|
|
98
|
+
}) => Promise<string>;
|
|
99
|
+
schemaCid: ({ publicClient, policyContractAddress, }: {
|
|
100
|
+
publicClient: PublicClient;
|
|
101
|
+
policyContractAddress: Address;
|
|
102
|
+
}) => Promise<string>;
|
|
73
103
|
precomputePolicyId: ({ publicClient, policyContractAddress, ...args }: {
|
|
74
104
|
publicClient: PublicClient;
|
|
75
105
|
policyContractAddress: Address;
|
|
@@ -90,9 +120,11 @@ export declare const policyFunctions: {
|
|
|
90
120
|
policyContractAddress: Address;
|
|
91
121
|
factory: Address;
|
|
92
122
|
entrypoint: string;
|
|
93
|
-
|
|
94
|
-
|
|
123
|
+
policyCid: string;
|
|
124
|
+
schemaCid: string;
|
|
95
125
|
policyData: Address[];
|
|
126
|
+
metadataCid: string;
|
|
127
|
+
owner: Address;
|
|
96
128
|
}) => Promise<`0x${string}`>;
|
|
97
129
|
renounceOwnership: ({ walletClient, policyContractAddress, }: {
|
|
98
130
|
walletClient: WalletClient;
|
|
@@ -103,10 +135,6 @@ export declare const policyFunctions: {
|
|
|
103
135
|
policyContractAddress: Address;
|
|
104
136
|
newOwner: Address;
|
|
105
137
|
}) => Promise<`0x${string}`>;
|
|
106
|
-
policyUri: ({ publicClient, policyContractAddress, }: {
|
|
107
|
-
publicClient: PublicClient;
|
|
108
|
-
policyContractAddress: Address;
|
|
109
|
-
}) => Promise<string>;
|
|
110
138
|
getPolicyId: ({ publicClient, policyContractAddress, client, }: {
|
|
111
139
|
publicClient: PublicClient;
|
|
112
140
|
policyContractAddress: Address;
|
|
@@ -138,10 +166,6 @@ export declare const policyFunctions: {
|
|
|
138
166
|
publicClient: PublicClient;
|
|
139
167
|
policyContractAddress: Address;
|
|
140
168
|
}) => Promise<string>;
|
|
141
|
-
schemaUri: ({ publicClient, policyContractAddress, }: {
|
|
142
|
-
publicClient: PublicClient;
|
|
143
|
-
policyContractAddress: Address;
|
|
144
|
-
}) => Promise<string>;
|
|
145
169
|
clientToPolicyId: ({ publicClient, policyContractAddress, client, }: {
|
|
146
170
|
publicClient: PublicClient;
|
|
147
171
|
policyContractAddress: Address;
|
|
@@ -152,6 +176,42 @@ export declare const policyFunctions: {
|
|
|
152
176
|
policyContractAddress: Address;
|
|
153
177
|
index: number;
|
|
154
178
|
}) => Promise<Address>;
|
|
179
|
+
getEntrypoint: ({ publicClient, policyContractAddress, }: {
|
|
180
|
+
publicClient: PublicClient;
|
|
181
|
+
policyContractAddress: Address;
|
|
182
|
+
}) => Promise<string>;
|
|
183
|
+
getMetadataCid: ({ publicClient, policyContractAddress, }: {
|
|
184
|
+
publicClient: PublicClient;
|
|
185
|
+
policyContractAddress: Address;
|
|
186
|
+
}) => Promise<string>;
|
|
187
|
+
getPolicyCid: ({ publicClient, policyContractAddress, }: {
|
|
188
|
+
publicClient: PublicClient;
|
|
189
|
+
policyContractAddress: Address;
|
|
190
|
+
}) => Promise<string>;
|
|
191
|
+
getPolicyData: ({ publicClient, policyContractAddress, }: {
|
|
192
|
+
publicClient: PublicClient;
|
|
193
|
+
policyContractAddress: Address;
|
|
194
|
+
}) => Promise<Address[]>;
|
|
195
|
+
getSchemaCid: ({ publicClient, policyContractAddress, }: {
|
|
196
|
+
publicClient: PublicClient;
|
|
197
|
+
policyContractAddress: Address;
|
|
198
|
+
}) => Promise<string>;
|
|
199
|
+
isPolicyVerified: ({ publicClient, policyContractAddress, }: {
|
|
200
|
+
publicClient: PublicClient;
|
|
201
|
+
policyContractAddress: Address;
|
|
202
|
+
}) => Promise<boolean>;
|
|
203
|
+
metadataCid: ({ publicClient, policyContractAddress, }: {
|
|
204
|
+
publicClient: PublicClient;
|
|
205
|
+
policyContractAddress: Address;
|
|
206
|
+
}) => Promise<string>;
|
|
207
|
+
policyCid: ({ publicClient, policyContractAddress, }: {
|
|
208
|
+
publicClient: PublicClient;
|
|
209
|
+
policyContractAddress: Address;
|
|
210
|
+
}) => Promise<string>;
|
|
211
|
+
schemaCid: ({ publicClient, policyContractAddress, }: {
|
|
212
|
+
publicClient: PublicClient;
|
|
213
|
+
policyContractAddress: Address;
|
|
214
|
+
}) => Promise<string>;
|
|
155
215
|
precomputePolicyId: ({ publicClient, policyContractAddress, ...args }: {
|
|
156
216
|
publicClient: PublicClient;
|
|
157
217
|
policyContractAddress: Address;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magicnewton/newton-protocol-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3--canary.78.18572445796.0",
|
|
4
4
|
"description": "Official SDK for the Newton Protocol.",
|
|
5
5
|
"author": "Newton Foundation <https://x.com/newtfoundation> (https://newton.foundation)",
|
|
6
6
|
"private": false,
|