UNPKG

@tribecahq/tribeca-sdk

Version:

The TypeScript SDK for Tribeca, an open standard and toolkit for launching DAOs on Solana.

49 lines 1.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createGovernorWithElectorate = void 0; const tslib_1 = require("tslib"); const web3_js_1 = require("@solana/web3.js"); const bn_js_1 = tslib_1.__importDefault(require("bn.js")); const __1 = require("../.."); const __2 = require(".."); /** * Creates a Governor. * @returns */ const createGovernorWithElectorate = async ({ createElectorate, sdk, gokiSDK, owners = [sdk.provider.wallet.publicKey], governanceParameters = __1.DEFAULT_GOVERNANCE_PARAMETERS, govBaseKP = web3_js_1.Keypair.generate(), smartWalletBaseKP = web3_js_1.Keypair.generate(), }) => { const [governor] = await (0, __2.findGovernorAddress)(govBaseKP.publicKey); const createTXs = []; const { smartWalletWrapper, tx: tx1 } = await gokiSDK.newSmartWallet({ owners: [...owners, governor], threshold: new bn_js_1.default(2), numOwners: 3, base: smartWalletBaseKP, }); createTXs.push({ title: "Create Smart Wallet", tx: tx1, }); const { key: electorate, tx: createElectorateTX } = await createElectorate(governor); const { wrapper: governorWrapper, tx: tx2 } = await sdk.govern.createGovernor({ ...governanceParameters, baseKP: govBaseKP, electorate, smartWallet: smartWalletWrapper.key, }); createTXs.push({ title: "Create Governor", tx: tx2, }); createTXs.push({ title: "Create Electorate", tx: createElectorateTX, }); return { governorWrapper, smartWalletWrapper, createTXs, electorate, }; }; exports.createGovernorWithElectorate = createGovernorWithElectorate; //# sourceMappingURL=setup.js.map