From 350a54ada968dc6ea24dcfd24bd60722a21d6dab Mon Sep 17 00:00:00 2001 From: Ken Goldfarb Date: Mon, 1 May 2023 11:36:31 -0600 Subject: [PATCH 1/5] feat: handle custom slack emoji --- src/controllers/SlackController.ts | 29 + src/routers/symphonyRouter.ts | 5 + src/services/Rule.ts | 2 +- src/services/Slack.ts | 128 +- src/types/meem.generated.ts | 1113 +++++++++-------- src/types/meem.public.generated.ts | 233 ++-- .../api/symphony/getSlackEmojis.shared.ts | 33 + src/types/shared/symphony.shared.ts | 3 +- 8 files changed, 870 insertions(+), 676 deletions(-) create mode 100644 src/types/shared/api/symphony/getSlackEmojis.shared.ts diff --git a/src/controllers/SlackController.ts b/src/controllers/SlackController.ts index 03d6d8f5..6cf3feab 100644 --- a/src/controllers/SlackController.ts +++ b/src/controllers/SlackController.ts @@ -382,4 +382,33 @@ export default class SlackController { challenge }) } + + public static async getEmojis( + req: IAuthenticatedRequest, + res: IResponse + ) { + const { agreementSlackId } = req.query + const agreementSlack = await orm.models.AgreementSlack.findOne({ + where: { + id: agreementSlackId + }, + include: [orm.models.Slack, orm.models.Agreement] + }) + + if (!agreementSlack || !agreementSlack.Slack || !agreementSlack.Agreement) { + throw new Error('SLACK_NOT_FOUND') + } + + const isAdmin = await agreementSlack.Agreement.isAdmin(req.wallet.address) + + if (!isAdmin) { + throw new Error('NOT_AUTHORIZED') + } + + const emojis = await services.slack.getEmojis({ + slack: agreementSlack.Slack + }) + + return res.json({ emojis }) + } } diff --git a/src/routers/symphonyRouter.ts b/src/routers/symphonyRouter.ts index 9abd4c04..7ccacf3b 100644 --- a/src/routers/symphonyRouter.ts +++ b/src/routers/symphonyRouter.ts @@ -45,6 +45,11 @@ export default (app: Express, _express: typeof coreExpress) => { router.getAsync('/twitter/auth', TwitterController.auth) router.getAsync('/twitter/callback', TwitterController.callback) router.getAsync('/slack/auth', SlackController.auth) + router.getAsync( + '/slack/emojis', + userLoggedInPolicy, + SlackController.getEmojis + ) router.getAsync('/slack/callback', SlackController.callback) router.getAsync( '/slack/channels', diff --git a/src/services/Rule.ts b/src/services/Rule.ts index 7c913c5b..ed289aea 100644 --- a/src/services/Rule.ts +++ b/src/services/Rule.ts @@ -70,7 +70,7 @@ export default class RuleService { switch (rule.input) { case MeemAPI.RuleIo.Slack: { - const r = services.slack.countReactions({ + const r = await services.slack.countReactions({ message: message as SlackMessage, rule, channelId diff --git a/src/services/Slack.ts b/src/services/Slack.ts index 182314d4..d6e2acaa 100644 --- a/src/services/Slack.ts +++ b/src/services/Slack.ts @@ -175,7 +175,7 @@ export default class SlackService { } /** Counts reactions for a message based on a rule */ - public static countReactions(options: { + public static async countReactions(options: { rule: Rule message: Message channelId: string @@ -197,6 +197,21 @@ export default class SlackService { vetoer: {} } + const agreementSlack = await orm.models.AgreementSlack.findOne({ + where: { + id: rule.inputRef + }, + include: [orm.models.Slack] + }) + + if (!agreementSlack?.Slack) { + throw new Error('SLACK_NOT_FOUND') + } + + const customSlackEmojis = await this.getEmojis({ + slack: agreementSlack.Slack + }) + const approverEmojis = rule.definition.approverEmojis const proposerEmojis = rule.definition.proposerEmojis const vetoerEmojis = rule.definition.vetoerEmojis @@ -204,44 +219,53 @@ export default class SlackService { if (message.reactions) { message.reactions.forEach(reaction => { if (reaction.name) { + let unicode: string | undefined const emoji = slackEmojis.find(e => e.short_name === reaction.name) + + const customEmoji = + !emoji && customSlackEmojis?.find(e => e.name === reaction.name) + if (emoji) { - const unicode = emoji.unified?.toLowerCase() - - if (unicode) { - const isApproverEmoji = - (rule.definition.publishType === - MeemAPI.PublishType.PublishImmediately || - (rule.definition.publishType === - MeemAPI.PublishType.Proposal && - rule.definition.proposalShareChannel === channelId)) && - approverEmojis && - approverEmojis.some(e => e.unified === unicode) - const isProposerEmoji = - rule.definition.publishType === MeemAPI.PublishType.Proposal && - rule.definition.proposalShareChannel !== channelId && - proposerEmojis && - proposerEmojis.some(e => e.unified === unicode) - const isVetoerEmoji = - vetoerEmojis && vetoerEmojis.some(e => e.unified === unicode) - - if (isApproverEmoji) { - if (!messageReactions.approver[unicode]) { - messageReactions.approver[unicode] = 0 - } - messageReactions.approver[unicode] += reaction.count ?? 0 - } else if (isProposerEmoji) { - if (!messageReactions.proposer[unicode]) { - messageReactions.proposer[unicode] = 0 - } - messageReactions.proposer[unicode] += reaction.count ?? 0 - } else if (isVetoerEmoji) { - if (!messageReactions.vetoer[unicode]) { - messageReactions.vetoer[unicode] = 0 - } - messageReactions.vetoer[unicode] += reaction.count ?? 0 - } + unicode = emoji.unified?.toLowerCase() + } + + const isApproverEmoji = + (rule.definition.publishType === + MeemAPI.PublishType.PublishImmediately || + (rule.definition.publishType === MeemAPI.PublishType.Proposal && + rule.definition.proposalShareChannel === channelId)) && + approverEmojis && + approverEmojis.some(e => + customEmoji ? e.name === customEmoji.name : e.unified === unicode + ) + const isProposerEmoji = + rule.definition.publishType === MeemAPI.PublishType.Proposal && + rule.definition.proposalShareChannel !== channelId && + proposerEmojis && + proposerEmojis.some(e => + customEmoji ? e.name === customEmoji.name : e.unified === unicode + ) + const isVetoerEmoji = + vetoerEmojis && + vetoerEmojis.some(e => + customEmoji ? e.name === customEmoji.name : e.unified === unicode + ) + + if (isApproverEmoji) { + if (!messageReactions.approver[unicode]) { + messageReactions.approver[unicode] = 0 } + messageReactions.approver[unicode] += reaction.count ?? 0 + } else if (isProposerEmoji) { + if (!messageReactions.proposer[unicode]) { + messageReactions.proposer[unicode] = 0 + } + messageReactions.proposer[unicode] += reaction.count ?? 0 + } else if (isVetoerEmoji) { + if (!messageReactions.vetoer[unicode]) { + messageReactions.vetoer[unicode] = 0 + } + messageReactions.vetoer[unicode] += reaction.count ?? 0 } } }) @@ -269,4 +293,36 @@ export default class SlackService { messageReactions } } + + public static async getEmojis(options: { slack: Slack }) { + const { slack } = options + + const decrypted = await services.data.decrypt({ + strToDecrypt: slack.encryptedAccessToken, + privateKey: config.ENCRYPTION_KEY + }) + + const client = this.getClient(decrypted.data.accessToken) + + const result = await client.emoji.list() + if (!result.emoji) { + return [] + } + + const emojis: MeemAPI.IEmoji[] = [] + + Object.keys(result.emoji).forEach(key => { + const val = result.emoji && result.emoji[key] + if (val && /^http/.test(val)) { + emojis.push({ + id: key, + type: MeemAPI.EmojiType.Slack, + name: key, + url: val + }) + } + }) + + return emojis + } } diff --git a/src/types/meem.generated.ts b/src/types/meem.generated.ts index e2f1cc66..69db671d 100644 --- a/src/types/meem.generated.ts +++ b/src/types/meem.generated.ts @@ -783,7 +783,8 @@ export enum PublishType { export enum EmojiType { Unified = 'unified', - Discord = 'discord' + Discord = 'discord', + Slack = 'slack' } export interface IEmoji { @@ -1056,25 +1057,29 @@ export namespace Login { -export namespace AuthenticateWithDiscord { - export interface IPathParams {} +/** Bulk mint agreement role tokens */ +export namespace BulkBurnAgreementRoleTokens { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + /** The id of the agreement role */ + agreementRoleId: string + } - export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkBurn` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string + tokenIds: string[] } export interface IResponseBody extends IApiResponseBody { - user: { [key: string]: any } - accessToken: string + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1089,26 +1094,28 @@ export namespace AuthenticateWithDiscord { -export namespace GetDiscordServers { - export interface IPathParams {} - export const path = (options: IPathParams) => `/api/1.0/discord/servers` +/** Bulk mint agreement tokens */ +export namespace BulkBurnAgreementTokens { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + } - export const method = HttpMethod.Get + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/bulkBurn` - export interface IQueryParams { - accessToken: string - } + export const method = HttpMethod.Post + + export interface IQueryParams {} export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string + tokenIds: string[] } export interface IResponseBody extends IApiResponseBody { - discordServers: IDiscordServer[] + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1123,29 +1130,36 @@ export namespace GetDiscordServers { -export namespace CreateBundle { - export interface IPathParams {} - export const path = () => `/api/1.0/epm/bundles` +/** Bulk mint agreement role tokens */ +export namespace BulkMintAgreementRoleTokens { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + /** The id of the agreement role */ + agreementRoleId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkMint` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - name: string - description: string - // contractIds: string[] - contracts: { - id: string - functionSelectors: string[] + tokens: { + /** Token metadata */ + metadata?: IMeemMetadataLike + + /** The address where the token will be minted to. */ + to: string }[] } export interface IResponseBody extends IApiResponseBody { - bundleId: string - types: string - abi: Record[] + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1160,26 +1174,34 @@ export namespace CreateBundle { -export namespace CreateContract { - export interface IPathParams {} - export const path = () => `/api/1.0/epm/contracts` +/** Bulk mint agreement tokens */ +export namespace BulkMintAgreementTokens { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/bulkMint` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - name: string - description: string - contractType: ContractType - abi: any[] - bytecode: string + tokens: { + /** The token metadata */ + metadata?: IMeemMetadataLike + + /** The address where the token will be minted */ + to: string + }[] } export interface IResponseBody extends IApiResponseBody { - status: 'success' - contractId: string + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1194,22 +1216,25 @@ export namespace CreateContract { -export namespace TrackContractInstance { - export interface IPathParams {} - export const path = () => `/api/1.0/epm/contractInstances` +/** Checks if the current user is an Agreement admin either by holding the Admin token or having the admin role on the contract */ +export namespace CheckIsAgreementAdmin { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + } - export const method = HttpMethod.Post + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/isAdmin` + + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - address: string - chainId: number - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - status: 'success' + isAdmin: boolean } export interface IDefinition { @@ -1224,60 +1249,99 @@ export namespace TrackContractInstance { -export namespace UntrackContractInstance { - export interface IPathParams { - contractInstanceId: string - } +/** Create an agreement contract. */ +export namespace CreateAgreement { + export interface IPathParams {} - export const path = (options: IPathParams) => - `/api/1.0/epm/contractInstances/${options.contractInstanceId}` + export const path = () => `/api/1.0/agreements` - export const method = HttpMethod.Delete + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** The name of the contract */ + name: string - export interface IResponseBody extends IApiResponseBody { - status: 'success' - } + /** Agreement contract metadata */ + metadata: IMeemMetadataLike - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } + /** If true, will deploy the contract on the chain. Default false */ + isOnChain?: boolean - export type Response = IResponseBody | IError -} + /** If true a contract will be deployed. Default false */ + shouldCreateContract?: boolean + /** The contract chain id */ + chainId?: number + /** The max number of tokens */ + maxSupply?: string -export namespace UpdateBundle { - export interface IPathParams { - bundleId: string - } + /** Whether the max number of tokens is locked */ + isMaxSupplyLocked?: boolean - export const path = (options: IPathParams) => - `/api/1.0/epm/bundles/${options.bundleId}` + /** The contract symbol. If omitted, will use slug generated from name. */ + symbol?: string - export const method = HttpMethod.Put + /** Contract admin addresses */ + admins?: string[] - export interface IQueryParams {} + /** Special minter permissions */ + minters?: string[] - export interface IRequestBody { - name: string - description: string - contracts: { - id: string - functionSelectors: string[] - }[] + /** Minting permissions */ + mintPermissions?: Omit[] + + /** Splits for minting / transfers */ + splits?: IMeemSplit[] + + /** Whether tokens can be transferred */ + isTransferLocked?: boolean + + /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ + shouldMintTokens?: boolean + + /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ + members?: string[] + + /** Token metadata to use if shouldMintTokens is true */ + tokenMetadata?: IMeemMetadataLike + + /** If true, will create an admin role contract and set it as the admin contract for this agreement */ + shouldCreateAdminRole?: boolean } export interface IResponseBody extends IApiResponseBody { - types: string - abi: Record[] + /** The Transaction id for deploying the contract. Transaction #1 */ + deployContractTxId?: string + + /** The Transaction id for initializing the contract. Transaction #2 */ + cutTxId?: string + + /** The Transaction id for minting tokens. Transaction #3 */ + mintTxId?: string + + /** The Transaction id for deploying the admin role contract. Transaction #4 */ + adminRoleDeployContractTxId?: string + + /** The Transaction id for initializing the admin role contract. Transaction #5 */ + adminRoleCutTxId?: string + + /** The Transaction id for setting the role contract as the admin contract on the agreement. Transaction #6 */ + adminRoleSetAdminContractTxId?: string + + /** The Transaction id for minting admin role tokens. Transaction #7 */ + adminRoleMintTxId?: string + + /** The agreement id. Available only if isOnChain=false */ + agreementId?: string + + /** The admin agreement id. Available only if isOnChain=false */ + adminAgreementId?: string + + /** The slug for the agreement. Available only if isOnChain=false */ + slug?: string } export interface IDefinition { @@ -1292,25 +1356,60 @@ export namespace UpdateBundle { -export namespace UpdateWalletContractInstance { + +/** Create an agreement extension */ +export namespace CreateAgreementExtension { export interface IPathParams { - contractInstanceId: string + /** The id of the agreement */ + agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/epm/walletContractInstances/${options.contractInstanceId}` + `/api/1.0/agreements/${options.agreementId}/extensions` - export const method = HttpMethod.Patch + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - note: string - name: string - } + /** The id of the extension to enable */ + extensionId: string + + /** Whether the extension initialization is complete */ + isInitialized?: boolean + + /** Whether the extension setup is complete */ + isSetupComplete?: boolean + + /** Optional metadata associated with this extension */ + metadata?: { + [key: string]: any + } + + /** Optional external link associated with this extension */ + externalLink?: { + /** Url for the link */ + url: string + /** The link label */ + label?: string + /** Visibility of the link extension */ + visibility?: AgreementExtensionVisibility + } + + /** Optional widget data associated with this extension */ + widget?: { + /** Metadata associated with the extension widget */ + metadata?: IMeemMetadataLike + /** Visibility of the widget extension */ + visibility?: AgreementExtensionVisibility + } + } export interface IResponseBody extends IApiResponseBody { status: 'success' + + /** The Transaction ids that must be completed as part of creating the extension. May be empty if no transactions are required. */ + txIds: string[] } export interface IDefinition { @@ -1325,29 +1424,62 @@ export namespace UpdateWalletContractInstance { -/** Bulk mint agreement role tokens */ -export namespace BulkBurnAgreementRoleTokens { + +/** Create an agreement role contract */ +export namespace CreateAgreementRole { export interface IPathParams { /** The id of the agreement */ agreementId: string - /** The id of the agreement role */ - agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkBurn` + `/api/1.0/agreements/${options.agreementId}/roles` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - tokenIds: string[] + /** The name of the agreement role contract */ + name: string + + /** Agreement role contract metadata */ + metadata: IMeemMetadataLike + + /** The max number of tokens */ + maxSupply: string + + /** Whether the max supply is locked */ + isMaxSupplyLocked?: boolean + + /** The contract symbol. If omitted, will use slug generated from name */ + symbol?: string + + /** Splits for minting / transfers */ + splits?: IMeemSplit[] + + /** Whether tokens can be transferred */ + isTransferLocked?: boolean + + /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ + shouldMintTokens?: boolean + + /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ + members?: string[] + + /** Token metadata to use if shouldMintTokens is true */ + tokenMetadata?: IMeemMetadataLike } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + /** The Transaction id for deploying the contract. Transaction #1 */ + deployContractTxId: string + + /** The Transaction id for initializing the contract. Transaction #2 */ + cutTxId: string + + /** The Transaction id for minting tokens. Transaction #3 */ + mintTxId?: string } export interface IDefinition { @@ -1363,27 +1495,33 @@ export namespace BulkBurnAgreementRoleTokens { -/** Bulk mint agreement tokens */ -export namespace BulkBurnAgreementTokens { +/** Create an agreement safe */ +export namespace CreateAgreementSafe { export interface IPathParams { - /** The id of the agreement */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/bulkBurn` + `/api/1.0/agreements/${options.agreementId}/safe` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - tokenIds: string[] + /** Addresses of the safe owners */ + safeOwners: string[] + + /** Chain id of the safe */ + chainId?: number + + /** The number of signatures required */ + threshold?: number } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + /** The Transaction id */ + txId: string } export interface IDefinition { @@ -1399,8 +1537,8 @@ export namespace BulkBurnAgreementTokens { -/** Bulk mint agreement role tokens */ -export namespace BulkMintAgreementRoleTokens { +/** Delete an agreement role contract */ +export namespace DeleteAgreementRole { export interface IPathParams { /** The id of the agreement */ agreementId: string @@ -1409,25 +1547,16 @@ export namespace BulkMintAgreementRoleTokens { } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkMint` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` - export const method = HttpMethod.Post + export const method = HttpMethod.Delete export interface IQueryParams {} - export interface IRequestBody { - tokens: { - /** Token metadata */ - metadata?: IMeemMetadataLike - - /** The address where the token will be minted to. */ - to: string - }[] - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + status: 'success' } export interface IDefinition { @@ -1443,33 +1572,26 @@ export namespace BulkMintAgreementRoleTokens { -/** Bulk mint agreement tokens */ -export namespace BulkMintAgreementTokens { +/** Get an agreement role */ +export namespace GetAgreementRole { export interface IPathParams { /** The id of the agreement */ agreementId: string + /** The id of the agreement role */ + agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/bulkMint` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` - export const method = HttpMethod.Post + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - tokens: { - /** The token metadata */ - metadata?: IMeemMetadataLike - - /** The address where the token will be minted */ - to: string - }[] - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + role: IAgreementRole } export interface IDefinition { @@ -1485,15 +1607,14 @@ export namespace BulkMintAgreementTokens { -/** Checks if the current user is an Agreement admin either by holding the Admin token or having the admin role on the contract */ -export namespace CheckIsAgreementAdmin { +export namespace GetAgreementRoles { export interface IPathParams { - /** The id of the agreement */ + /** The Agreement id to fetch roles of */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/isAdmin` + `/api/1.0/agreements/${options.agreementId}/roles` export const method = HttpMethod.Get @@ -1502,7 +1623,7 @@ export namespace CheckIsAgreementAdmin { export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - isAdmin: boolean + roles: any[] } export interface IDefinition { @@ -1517,99 +1638,61 @@ export namespace CheckIsAgreementAdmin { -/** Create an agreement contract. */ -export namespace CreateAgreement { - export interface IPathParams {} - export const path = () => `/api/1.0/agreements` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - /** The name of the contract */ - name: string +/** Get agreement minting proof */ +export namespace GetMintingProof { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + } - /** Agreement contract metadata */ - metadata: IMeemMetadataLike + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/proof` - /** If true, will deploy the contract on the chain. Default false */ - isOnChain?: boolean + export const method = HttpMethod.Get - /** If true a contract will be deployed. Default false */ - shouldCreateContract?: boolean + export interface IQueryParams {} - /** The contract chain id */ - chainId?: number + export interface IRequestBody {} - /** The max number of tokens */ - maxSupply?: string + export interface IResponseBody extends IApiResponseBody { + proof: string[] + } - /** Whether the max number of tokens is locked */ - isMaxSupplyLocked?: boolean + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } - /** The contract symbol. If omitted, will use slug generated from name. */ - symbol?: string + export type Response = IResponseBody | IError +} - /** Contract admin addresses */ - admins?: string[] - /** Special minter permissions */ - minters?: string[] - /** Minting permissions */ - mintPermissions?: Omit[] - /** Splits for minting / transfers */ - splits?: IMeemSplit[] +/** Check if agreement slug is available */ +export namespace IsSlugAvailable { + export interface IPathParams {} - /** Whether tokens can be transferred */ - isTransferLocked?: boolean + export const path = (options: IPathParams) => + `/api/1.0/agreements/isSlugAvailable` - /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ - shouldMintTokens?: boolean + export const method = HttpMethod.Post - /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ - members?: string[] + export interface IQueryParams {} - /** Token metadata to use if shouldMintTokens is true */ - tokenMetadata?: IMeemMetadataLike + export interface IRequestBody { + /** New agreement slug to check */ + slug: string - /** If true, will create an admin role contract and set it as the admin contract for this agreement */ - shouldCreateAdminRole?: boolean + /** The chain id of new agreement */ + chainId: number } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for deploying the contract. Transaction #1 */ - deployContractTxId?: string - - /** The Transaction id for initializing the contract. Transaction #2 */ - cutTxId?: string - - /** The Transaction id for minting tokens. Transaction #3 */ - mintTxId?: string - - /** The Transaction id for deploying the admin role contract. Transaction #4 */ - adminRoleDeployContractTxId?: string - - /** The Transaction id for initializing the admin role contract. Transaction #5 */ - adminRoleCutTxId?: string - - /** The Transaction id for setting the role contract as the admin contract on the agreement. Transaction #6 */ - adminRoleSetAdminContractTxId?: string - - /** The Transaction id for minting admin role tokens. Transaction #7 */ - adminRoleMintTxId?: string - - /** The agreement id. Available only if isOnChain=false */ - agreementId?: string - - /** The admin agreement id. Available only if isOnChain=false */ - adminAgreementId?: string - - /** The slug for the agreement. Available only if isOnChain=false */ - slug?: string + isSlugAvailable: boolean } export interface IDefinition { @@ -1625,59 +1708,52 @@ export namespace CreateAgreement { -/** Create an agreement extension */ -export namespace CreateAgreementExtension { +/** Reinitialize an agreement contract */ +export namespace ReInitializeAgreement { export interface IPathParams { /** The id of the agreement */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/extensions` + `/api/1.0/agreements/${options.agreementId}/reinitialize` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The id of the extension to enable */ - extensionId: string + /** The name of the contract */ + name?: string - /** Whether the extension initialization is complete */ - isInitialized?: boolean + /** The max number of tokens */ + maxSupply?: string - /** Whether the extension setup is complete */ - isSetupComplete?: boolean + /** Agreement contract metadata */ + metadata?: IMeemMetadataLike - /** Optional metadata associated with this extension */ - metadata?: { - [key: string]: any - } + /** The contract symbol. If omitted, will use slug generated from name */ + symbol?: string - /** Optional external link associated with this extension */ - externalLink?: { - /** Url for the link */ - url: string - /** The link label */ - label?: string - /** Visibility of the link extension */ - visibility?: AgreementExtensionVisibility - } + /** Contract admin addresses */ + admins?: string[] - /** Optional widget data associated with this extension */ - widget?: { - /** Metadata associated with the extension widget */ - metadata?: IMeemMetadataLike - /** Visibility of the widget extension */ - visibility?: AgreementExtensionVisibility - } + /** Special minter permissions */ + minters?: string[] + + /** Minting permissions */ + mintPermissions?: Omit[] + + /** Splits for minting / transfers */ + splits?: IMeemSplit[] + + /** Whether tokens can be transferred */ + isTransferLocked?: boolean } export interface IResponseBody extends IApiResponseBody { - status: 'success' - - /** The Transaction ids that must be completed as part of creating the extension. May be empty if no transactions are required. */ - txIds: string[] + /** The Transaction id for updating the contract. Only available if agreement is on chain */ + txId?: string } export interface IDefinition { @@ -1693,32 +1769,31 @@ export namespace CreateAgreementExtension { -/** Create an agreement role contract */ -export namespace CreateAgreementRole { +/** Reinitialize an agreement contract */ +export namespace ReInitializeAgreementRole { export interface IPathParams { /** The id of the agreement */ agreementId: string + /** The id of the agreement role */ + agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/reinitialize` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The name of the agreement role contract */ - name: string - - /** Agreement role contract metadata */ - metadata: IMeemMetadataLike + /** The name of the contract */ + name?: string /** The max number of tokens */ - maxSupply: string + maxSupply?: string - /** Whether the max supply is locked */ - isMaxSupplyLocked?: boolean + /** Agreement role contract metadata */ + metadata?: IMeemMetadataLike /** The contract symbol. If omitted, will use slug generated from name */ symbol?: string @@ -1728,26 +1803,11 @@ export namespace CreateAgreementRole { /** Whether tokens can be transferred */ isTransferLocked?: boolean - - /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ - shouldMintTokens?: boolean - - /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ - members?: string[] - - /** Token metadata to use if shouldMintTokens is true */ - tokenMetadata?: IMeemMetadataLike } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for deploying the contract. Transaction #1 */ - deployContractTxId: string - - /** The Transaction id for initializing the contract. Transaction #2 */ - cutTxId: string - - /** The Transaction id for minting tokens. Transaction #3 */ - mintTxId?: string + /** The Transaction id for updating the contract. Only available if agreement is on chain */ + txId?: string } export interface IDefinition { @@ -1763,28 +1823,23 @@ export namespace CreateAgreementRole { -/** Create an agreement safe */ -export namespace CreateAgreementSafe { +/** Set the agreement admin role */ +export namespace SetAgreementAdminRole { export interface IPathParams { + /** The id of the agreement */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/safe` + `/api/1.0/agreements/${options.agreementId}/setAdminRole` - export const method = HttpMethod.Post + export const method = HttpMethod.Patch export interface IQueryParams {} export interface IRequestBody { - /** Addresses of the safe owners */ - safeOwners: string[] - - /** Chain id of the safe */ - chainId?: number - - /** The number of signatures required */ - threshold?: number + /** The id of the agreement role to set as admin role */ + adminAgreementRoleId: string } export interface IResponseBody extends IApiResponseBody { @@ -1798,30 +1853,31 @@ export namespace CreateAgreementSafe { requestBody: IRequestBody responseBody: IResponseBody } - - export type Response = IResponseBody | IError } -/** Delete an agreement role contract */ -export namespace DeleteAgreementRole { +/** Set the agreement safe address */ +export namespace SetAgreementSafeAddress { export interface IPathParams { - /** The id of the agreement */ agreementId: string - /** The id of the agreement role */ - agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` + `/api/1.0/agreements/${options.agreementId}/safe` - export const method = HttpMethod.Delete + export const method = HttpMethod.Patch export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** The safe address */ + address: string + + /** Chain id of the safe */ + chainId?: number + } export interface IResponseBody extends IApiResponseBody { status: 'success' @@ -1840,26 +1896,27 @@ export namespace DeleteAgreementRole { -/** Get an agreement role */ -export namespace GetAgreementRole { +/** Update off-chain agreement data */ +export namespace UpdateAgreement { export interface IPathParams { /** The id of the agreement */ agreementId: string - /** The id of the agreement role */ - agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` + `/api/1.0/agreements/${options.agreementId}` - export const method = HttpMethod.Get + export const method = HttpMethod.Patch export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** Whether the agreement is launched and visible to members */ + isLaunched: boolean + } export interface IResponseBody extends IApiResponseBody { - role: IAgreementRole + status: 'success' } export interface IDefinition { @@ -1875,23 +1932,56 @@ export namespace GetAgreementRole { -export namespace GetAgreementRoles { +/** Update an agreement extension */ +export namespace UpdateAgreementExtension { export interface IPathParams { - /** The Agreement id to fetch roles of */ + /** The id of the agreement */ agreementId: string + + /** The agreement extension id */ + agreementExtensionId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles` + `/api/1.0/agreements/${options.agreementId}/extensions/${options.agreementExtensionId}` - export const method = HttpMethod.Get + export const method = HttpMethod.Put export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** Whether the extension initialization is complete */ + isInitialized?: boolean + /** Whether the extension setup is complete */ + isSetupComplete?: boolean + /** Optional metadata associated with this extension */ + metadata?: { + [key: string]: any + } | null + /** Optional external link associated with this extension */ + externalLink?: { + /** Url for the link */ + url: string + /** The link label */ + label?: string + /** Whether link should be enabled */ + isEnabled?: boolean + /** Visibility of the extension link */ + visibility?: AgreementExtensionVisibility + } | null + /** Optional widget data associated with this extension */ + widget?: { + /** Metadata associated with the extension widget */ + metadata?: IMeemMetadataLike + /** Whether widget should be enabled */ + isEnabled?: boolean + /** Visibility of the extension widget */ + visibility?: AgreementExtensionVisibility + } | null + } export interface IResponseBody extends IApiResponseBody { - roles: any[] + status: 'success' } export interface IDefinition { @@ -1907,24 +1997,27 @@ export namespace GetAgreementRoles { -/** Get agreement minting proof */ -export namespace GetMintingProof { +/** Upgrade an agreement contract */ +export namespace UpgradeAgreement { export interface IPathParams { - /** The id of the agreement */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/proof` + `/api/1.0/agreements/${options.agreementId}/upgrade` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ + bundleId?: string + } export interface IResponseBody extends IApiResponseBody { - proof: string[] + /** The Transaction id */ + txId: string } export interface IDefinition { @@ -1940,27 +2033,30 @@ export namespace GetMintingProof { -/** Check if agreement slug is available */ -export namespace IsSlugAvailable { - export interface IPathParams {} +/** Upgrade an agreement role contract */ +export namespace UpgradeAgreementRole { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + /** The id of the agreement role */ + agreementRoleId: string + } export const path = (options: IPathParams) => - `/api/1.0/agreements/isSlugAvailable` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/upgrade` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** New agreement slug to check */ - slug: string - - /** The chain id of new agreement */ - chainId: number + /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ + bundleId?: string } export interface IResponseBody extends IApiResponseBody { - isSlugAvailable: boolean + /** The Transaction id */ + txId: string } export interface IDefinition { @@ -1976,52 +2072,25 @@ export namespace IsSlugAvailable { -/** Reinitialize an agreement contract */ -export namespace ReInitializeAgreement { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - } +export namespace AuthenticateWithDiscord { + export interface IPathParams {} - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/reinitialize` + export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The name of the contract */ - name?: string - - /** The max number of tokens */ - maxSupply?: string - - /** Agreement contract metadata */ - metadata?: IMeemMetadataLike - - /** The contract symbol. If omitted, will use slug generated from name */ - symbol?: string - - /** Contract admin addresses */ - admins?: string[] - - /** Special minter permissions */ - minters?: string[] - - /** Minting permissions */ - mintPermissions?: Omit[] - - /** Splits for minting / transfers */ - splits?: IMeemSplit[] - - /** Whether tokens can be transferred */ - isTransferLocked?: boolean + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for updating the contract. Only available if agreement is on chain */ - txId?: string + user: { [key: string]: any } + accessToken: string } export interface IDefinition { @@ -2036,46 +2105,26 @@ export namespace ReInitializeAgreement { +export namespace GetDiscordServers { + export interface IPathParams {} -/** Reinitialize an agreement contract */ -export namespace ReInitializeAgreementRole { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - /** The id of the agreement role */ - agreementRoleId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/reinitialize` + export const path = (options: IPathParams) => `/api/1.0/discord/servers` - export const method = HttpMethod.Post + export const method = HttpMethod.Get - export interface IQueryParams {} + export interface IQueryParams { + accessToken: string + } export interface IRequestBody { - /** The name of the contract */ - name?: string - - /** The max number of tokens */ - maxSupply?: string - - /** Agreement role contract metadata */ - metadata?: IMeemMetadataLike - - /** The contract symbol. If omitted, will use slug generated from name */ - symbol?: string - - /** Splits for minting / transfers */ - splits?: IMeemSplit[] - - /** Whether tokens can be transferred */ - isTransferLocked?: boolean + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for updating the contract. Only available if agreement is on chain */ - txId?: string + discordServers: IDiscordServer[] } export interface IDefinition { @@ -2089,30 +2138,33 @@ export namespace ReInitializeAgreementRole { } - - -/** Set the agreement admin role */ -export namespace SetAgreementAdminRole { + +export namespace GetJoinGuildMessage { export interface IPathParams { - /** The id of the agreement */ + /** The Agreement id */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/setAdminRole` + `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` - export const method = HttpMethod.Patch + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - /** The id of the agreement role to set as admin role */ - adminAgreementRoleId: string - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - /** The Transaction id */ - txId: string + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } } export interface IDefinition { @@ -2121,30 +2173,38 @@ export namespace SetAgreementAdminRole { requestBody: IRequestBody responseBody: IResponseBody } -} + export type Response = IResponseBody | IError +} -/** Set the agreement safe address */ -export namespace SetAgreementSafeAddress { +export namespace JoinGuild { export interface IPathParams { + /** The Agreement id */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/safe` + `/api/1.0/agreements/${options.agreementId}/joinGuild` - export const method = HttpMethod.Patch + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The safe address */ - address: string - - /** Chain id of the safe */ - chainId?: number + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } + sig: string + mintToken?: boolean } export interface IResponseBody extends IApiResponseBody { @@ -2163,28 +2223,29 @@ export namespace SetAgreementSafeAddress { +export namespace CreateBundle { + export interface IPathParams {} -/** Update off-chain agreement data */ -export namespace UpdateAgreement { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}` + export const path = () => `/api/1.0/epm/bundles` - export const method = HttpMethod.Patch + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** Whether the agreement is launched and visible to members */ - isLaunched: boolean + name: string + description: string + // contractIds: string[] + contracts: { + id: string + functionSelectors: string[] + }[] } export interface IResponseBody extends IApiResponseBody { - status: 'success' + bundleId: string + types: string + abi: Record[] } export interface IDefinition { @@ -2199,57 +2260,26 @@ export namespace UpdateAgreement { +export namespace CreateContract { + export interface IPathParams {} -/** Update an agreement extension */ -export namespace UpdateAgreementExtension { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - - /** The agreement extension id */ - agreementExtensionId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/extensions/${options.agreementExtensionId}` + export const path = () => `/api/1.0/epm/contracts` - export const method = HttpMethod.Put + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** Whether the extension initialization is complete */ - isInitialized?: boolean - /** Whether the extension setup is complete */ - isSetupComplete?: boolean - /** Optional metadata associated with this extension */ - metadata?: { - [key: string]: any - } | null - /** Optional external link associated with this extension */ - externalLink?: { - /** Url for the link */ - url: string - /** The link label */ - label?: string - /** Whether link should be enabled */ - isEnabled?: boolean - /** Visibility of the extension link */ - visibility?: AgreementExtensionVisibility - } | null - /** Optional widget data associated with this extension */ - widget?: { - /** Metadata associated with the extension widget */ - metadata?: IMeemMetadataLike - /** Whether widget should be enabled */ - isEnabled?: boolean - /** Visibility of the extension widget */ - visibility?: AgreementExtensionVisibility - } | null + name: string + description: string + contractType: ContractType + abi: any[] + bytecode: string } export interface IResponseBody extends IApiResponseBody { status: 'success' + contractId: string } export interface IDefinition { @@ -2264,28 +2294,22 @@ export namespace UpdateAgreementExtension { +export namespace TrackContractInstance { + export interface IPathParams {} -/** Upgrade an agreement contract */ -export namespace UpgradeAgreement { - export interface IPathParams { - agreementId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/upgrade` + export const path = () => `/api/1.0/epm/contractInstances` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ - bundleId?: string + address: string + chainId: number } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id */ - txId: string + status: 'success' } export interface IDefinition { @@ -2300,31 +2324,22 @@ export namespace UpgradeAgreement { - -/** Upgrade an agreement role contract */ -export namespace UpgradeAgreementRole { +export namespace UntrackContractInstance { export interface IPathParams { - /** The id of the agreement */ - agreementId: string - /** The id of the agreement role */ - agreementRoleId: string + contractInstanceId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/upgrade` + `/api/1.0/epm/contractInstances/${options.contractInstanceId}` - export const method = HttpMethod.Post + export const method = HttpMethod.Delete export interface IQueryParams {} - export interface IRequestBody { - /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ - bundleId?: string - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - /** The Transaction id */ - txId: string + status: 'success' } export interface IDefinition { @@ -2339,33 +2354,30 @@ export namespace UpgradeAgreementRole { - -export namespace GetJoinGuildMessage { +export namespace UpdateBundle { export interface IPathParams { - /** The Agreement id */ - agreementId: string + bundleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` + `/api/1.0/epm/bundles/${options.bundleId}` - export const method = HttpMethod.Get + export const method = HttpMethod.Put export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + name: string + description: string + contracts: { + id: string + functionSelectors: string[] + }[] + } export interface IResponseBody extends IApiResponseBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } + types: string + abi: Record[] } export interface IDefinition { @@ -2380,32 +2392,21 @@ export namespace GetJoinGuildMessage { -export namespace JoinGuild { +export namespace UpdateWalletContractInstance { export interface IPathParams { - /** The Agreement id */ - agreementId: string + contractInstanceId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/joinGuild` + `/api/1.0/epm/walletContractInstances/${options.contractInstanceId}` - export const method = HttpMethod.Post + export const method = HttpMethod.Patch export interface IQueryParams {} export interface IRequestBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } - sig: string - mintToken?: boolean + note: string + name: string } export interface IResponseBody extends IApiResponseBody { @@ -2935,6 +2936,40 @@ export namespace GetSlackChannels { +export namespace GetSlackEmojis { + export interface IPathParams {} + + export const path = () => '/api/1.0/symphony/slack/emojis' + + export const method = HttpMethod.Get + + export interface IQueryParams { + agreementSlackId: string + } + + export interface IRequestBody {} + + export interface IResponseBody extends IApiResponseBody { + emojis: { + id: string + name: string + url?: string + isAnimated?: boolean | null + }[] + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + export namespace InviteDiscordBot { export interface IPathParams {} diff --git a/src/types/meem.public.generated.ts b/src/types/meem.public.generated.ts index 5d501871..c5385699 100644 --- a/src/types/meem.public.generated.ts +++ b/src/types/meem.public.generated.ts @@ -783,7 +783,8 @@ export enum PublishType { export enum EmojiType { Unified = 'unified', - Discord = 'discord' + Discord = 'discord', + Slack = 'slack' } export interface IEmoji { @@ -2136,6 +2137,90 @@ export namespace GetDiscordServers { +export namespace GetJoinGuildMessage { + export interface IPathParams { + /** The Agreement id */ + agreementId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` + + export const method = HttpMethod.Get + + export interface IQueryParams {} + + export interface IRequestBody {} + + export interface IResponseBody extends IApiResponseBody { + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + +export namespace JoinGuild { + export interface IPathParams { + /** The Agreement id */ + agreementId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/joinGuild` + + export const method = HttpMethod.Post + + export interface IQueryParams {} + + export interface IRequestBody { + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } + sig: string + mintToken?: boolean + } + + export interface IResponseBody extends IApiResponseBody { + status: 'success' + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + export namespace CreateBundle { export interface IPathParams {} @@ -2338,76 +2423,27 @@ export namespace UpdateWalletContractInstance { -export namespace GetJoinGuildMessage { - export interface IPathParams { - /** The Agreement id */ - agreementId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` - - export const method = HttpMethod.Get - - export interface IQueryParams {} - - export interface IRequestBody {} - - export interface IResponseBody extends IApiResponseBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace JoinGuild { - export interface IPathParams { - /** The Agreement id */ - agreementId: string - } +/** Save some data to IPFS */ +export namespace SaveToIPFS { + export interface IPathParams {} - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/joinGuild` + export const path = () => `/api/1.0/ipfs` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } - sig: string - mintToken?: boolean + /** The data to save. Only one of "data" or "json" should be sent */ + data?: string + + /** The JSON to save. Only one of "data" or "json" should be sent */ + json?: Record } export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The IPFS hash for the saved data */ + ipfsHash: string } export interface IDefinition { @@ -2420,6 +2456,9 @@ export namespace JoinGuild { export type Response = IResponseBody | IError } +// TODO: How to specify json in OpenAPI definition + + /** Create or update the current user */ @@ -2621,44 +2660,6 @@ export namespace UpdateUserIdentity { -/** Save some data to IPFS */ -export namespace SaveToIPFS { - export interface IPathParams {} - - export const path = () => `/api/1.0/ipfs` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - /** The data to save. Only one of "data" or "json" should be sent */ - data?: string - - /** The JSON to save. Only one of "data" or "json" should be sent */ - json?: Record - } - - export interface IResponseBody extends IApiResponseBody { - /** The IPFS hash for the saved data */ - ipfsHash: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - -// TODO: How to specify json in OpenAPI definition - - - - /** Redirect the user to this endpoint to authenticate w/ slack */ export namespace AuthenticateWithSlack { export interface IPathParams {} @@ -2933,6 +2934,40 @@ export namespace GetSlackChannels { +export namespace GetSlackEmojis { + export interface IPathParams {} + + export const path = () => '/api/1.0/symphony/slack/emojis' + + export const method = HttpMethod.Get + + export interface IQueryParams { + agreementSlackId: string + } + + export interface IRequestBody {} + + export interface IResponseBody extends IApiResponseBody { + emojis: { + id: string + name: string + url?: string + isAnimated?: boolean | null + }[] + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + export namespace InviteDiscordBot { export interface IPathParams {} diff --git a/src/types/shared/api/symphony/getSlackEmojis.shared.ts b/src/types/shared/api/symphony/getSlackEmojis.shared.ts new file mode 100644 index 00000000..1b5afd64 --- /dev/null +++ b/src/types/shared/api/symphony/getSlackEmojis.shared.ts @@ -0,0 +1,33 @@ +import { IError, HttpMethod, IApiResponseBody } from '../../api.shared' + +export namespace GetSlackEmojis { + export interface IPathParams {} + + export const path = () => '/api/1.0/symphony/slack/emojis' + + export const method = HttpMethod.Get + + export interface IQueryParams { + agreementSlackId: string + } + + export interface IRequestBody {} + + export interface IResponseBody extends IApiResponseBody { + emojis: { + id: string + name: string + url?: string + isAnimated?: boolean | null + }[] + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} diff --git a/src/types/shared/symphony.shared.ts b/src/types/shared/symphony.shared.ts index 339b5c7d..366279d2 100644 --- a/src/types/shared/symphony.shared.ts +++ b/src/types/shared/symphony.shared.ts @@ -14,7 +14,8 @@ export enum PublishType { export enum EmojiType { Unified = 'unified', - Discord = 'discord' + Discord = 'discord', + Slack = 'slack' } export interface IEmoji { From 82e958977ac7b74aa53310386d4fd33652f2f8ac Mon Sep 17 00:00:00 2001 From: Ken Goldfarb Date: Tue, 2 May 2023 10:28:24 -0600 Subject: [PATCH 2/5] feat: slack emoji --- .vscode/settings.json | 1 + src/controllers/SlackController.ts | 11 - src/services/Discord.ts | 13 +- src/services/Rule.ts | 134 ++-- src/services/Slack.ts | 41 +- src/types/meem.generated.ts | 137 ++-- src/types/meem.public.generated.ts | 1157 ++++++++++++++------------- src/types/shared/symphony.shared.ts | 3 +- 8 files changed, 726 insertions(+), 771 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 2a4d7e1d..0637f668 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -52,6 +52,7 @@ "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, + "eslint.codeActionsOnSave.mode": "problems", "cSpell.ignorePaths": [ "**/package-lock.json", "**/node_modules/**", diff --git a/src/controllers/SlackController.ts b/src/controllers/SlackController.ts index 6cf3feab..6c4e0cf9 100644 --- a/src/controllers/SlackController.ts +++ b/src/controllers/SlackController.ts @@ -305,17 +305,6 @@ export default class SlackController { const message = history.messages[0] for (let i = 0; i < rules.length; i++) { const rule = rules[i] - const isHandled = await services.rule.isMessageHandled({ - agreementId: rule.AgreementId, - messageId: message.ts - }) - - if (isHandled) { - log.debug( - `Message w/ id ${message.ts} has already been handled` - ) - return - } await services.rule.processRule({ channelId: event.item.channel, rule, diff --git a/src/services/Discord.ts b/src/services/Discord.ts index 1fde2728..3128f140 100644 --- a/src/services/Discord.ts +++ b/src/services/Discord.ts @@ -395,18 +395,6 @@ export default class Discord { try { log.debug('handleMessageReactionForAgreement') - const isHandled = await services.rule.isMessageHandled({ - agreementId, - messageId: reaction.message.id - }) - - if (isHandled) { - log.debug( - `Message w/ id ${reaction.message.id} has already been handled` - ) - return - } - log.debug(`Handling message for agreementId: ${agreementId}`) const message = await reaction.message.channel.messages.fetch( @@ -433,6 +421,7 @@ export default class Discord { channelId: message.channelId, rule, message + }) } } diff --git a/src/services/Rule.ts b/src/services/Rule.ts index ed289aea..37e4a020 100644 --- a/src/services/Rule.ts +++ b/src/services/Rule.ts @@ -22,26 +22,6 @@ export type IOModel = | undefined export default class RuleService { - public static async isMessageHandled(options: { - messageId?: string | null - agreementId?: string | null - }) { - const { agreementId, messageId } = options - - const message = await orm.models.Message.findOne({ - where: { - AgreementId: agreementId, - messageId - } - }) - - if (message) { - return true - } - - return false - } - public static async processRule(options: { channelId: string rule: Rule @@ -49,15 +29,27 @@ export default class RuleService { }) { const { channelId, rule, message } = options + const messageId = + (message as DiscordMessage).id ?? (message as SlackMessage).ts + + const processedMessage = await orm.models.Message.findOne({ + where: { + AgreementId: rule.AgreementId, + messageId + } + }) + if (!rule.input || !rule.output) { log.crit(`Rule ${rule.id} has no input or output`) return } - log.debug({ message }) + if (processedMessage?.status === MeemAPI.MessageStatus.Handled) { + log.debug(`Message ${messageId} already handled`) + return + } - const messageId = - (message as DiscordMessage).id ?? (message as SlackMessage).ts + log.debug({ message }) let parentChannelId: string | undefined @@ -129,13 +121,8 @@ export default class RuleService { totalVetoers }) - const { shouldPublish } = ruleResult - const { shouldMarkAsHandled } = ruleResult - - // const ms = message as SlackMessage - // const md = message as DiscordMessage - - // ms.attachments + const { shouldPublish, shouldMarkAsHandled, shouldMarkAsAwaitingApproval } = + ruleResult if (shouldPublish) { switch (rule.output) { @@ -182,43 +169,6 @@ export default class RuleService { partialResponse = services.discord.parseMessageForWebhook( message as DiscordMessage ) - // const m = message as DiscordMessage - // partialResponse.messageId = m.id - // partialResponse.createdTimestamp = m.createdTimestamp - // m.reactions.cache.forEach(r => { - // if (r.emoji.name) { - // partialResponse.reactions.push({ - // name: r.emoji.name, - // emoji: r.emoji.name, - // unicode: this.emojiToUnicode(r.emoji.name), - // count: r.count - // }) - // } - // }) - - // partialResponse.user = { - // id: m.author.id, - // username: m.author.username - // } - - // m.embeds.forEach(a => { - // attachments.push({ - // url: a.url, - // name: a.title, - // description: a.description - // }) - // }) - - // m.attachments?.forEach(a => { - // attachments.push({ - // url: a.url, - // mimeType: a.contentType, - // width: a.width, - // height: a.height, - // name: a.name, - // description: a.description - // }) - // }) } else if (typeof (message as SlackMessage).team === 'string') { const m = message as SlackMessage partialResponse.messageId = m.ts @@ -342,17 +292,33 @@ export default class RuleService { log.warn(`Output not supported for ${rule.output}`) break } + } else if ( + shouldMarkAsAwaitingApproval && + processedMessage?.status !== MeemAPI.MessageStatus.AwaitingApproval + ) { + await this.sendInputReply({ + rule, + channelId, + message, + content: + 'This message has enough votes and is awaiting editor approval.' + }) } else { log.debug('Not publishing for rule', { rule }) } - if (shouldMarkAsHandled) { - log.debug(`Marking message as handled: ${messageId}`) + if (shouldMarkAsAwaitingApproval || shouldMarkAsHandled) { + log.debug(`Marking message: ${messageId}`, { + shouldMarkAsHandled, + shouldMarkAsAwaitingApproval + }) await orm.models.Message.create({ AgreementId: rule.AgreementId, messageId, inputType: rule.input, - status: MeemAPI.MessageStatus.Handled + status: shouldMarkAsHandled + ? MeemAPI.MessageStatus.Handled + : MeemAPI.MessageStatus.AwaitingApproval }) } } @@ -428,6 +394,7 @@ export default class RuleService { } = options let shouldPublish = false let shouldMarkAsHandled = false + let shouldMarkAsAwaitingApproval = false if ( rule.definition.publishType === MeemAPI.PublishType.PublishImmediately && @@ -446,17 +413,23 @@ export default class RuleService { MeemAPI.PublishType.PublishAfterApproval && (rule.definition.proposalChannels.includes(channelId) || rule.definition.proposalChannels.includes('all')) && - totalApprovals >= rule.definition.votes && - totalEditors && - rule.definition.editorVotes && - totalEditors >= rule.definition.editorVotes && - (!rule.definition.canVeto || - (rule.definition.vetoVotes && totalVetoers < rule.definition.vetoVotes)) + totalApprovals >= rule.definition.votes ) { log.debug('Rule matched publish after approval') - // Publish it - shouldPublish = true - shouldMarkAsHandled = true + if ( + totalEditors && + rule.definition.editorVotes && + totalEditors >= rule.definition.editorVotes && + (!rule.definition.canVeto || + (rule.definition.vetoVotes && + totalVetoers < rule.definition.vetoVotes)) + ) { + // Publish it + shouldPublish = true + shouldMarkAsHandled = true + } else { + shouldMarkAsAwaitingApproval = true + } } else if ( rule.definition.publishType === MeemAPI.PublishType.PublishImmediatelyOrEditorApproval && @@ -506,7 +479,8 @@ export default class RuleService { return { shouldPublish, - shouldMarkAsHandled + shouldMarkAsHandled, + shouldMarkAsAwaitingApproval } } diff --git a/src/services/Slack.ts b/src/services/Slack.ts index d6e2acaa..c9278f82 100644 --- a/src/services/Slack.ts +++ b/src/services/Slack.ts @@ -208,10 +208,6 @@ export default class SlackService { throw new Error('SLACK_NOT_FOUND') } - const customSlackEmojis = await this.getEmojis({ - slack: agreementSlack.Slack - }) - const approverEmojis = rule.definition.approverEmojis const proposerEmojis = rule.definition.proposerEmojis const vetoerEmojis = rule.definition.vetoerEmojis @@ -219,14 +215,17 @@ export default class SlackService { if (message.reactions) { message.reactions.forEach(reaction => { if (reaction.name) { - let unicode: string | undefined + let reactionKey: string | undefined | boolean const emoji = slackEmojis.find(e => e.short_name === reaction.name) - const customEmoji = - !emoji && customSlackEmojis?.find(e => e.name === reaction.name) - if (emoji) { - unicode = emoji.unified?.toLowerCase() + reactionKey = emoji.unified?.toLowerCase() + } else { + reactionKey = reaction.name + } + + if (!reactionKey) { + return } const isApproverEmoji = @@ -236,36 +235,36 @@ export default class SlackService { rule.definition.proposalShareChannel === channelId)) && approverEmojis && approverEmojis.some(e => - customEmoji ? e.name === customEmoji.name : e.unified === unicode + !emoji ? e.name === reaction.name : e.unified === reactionKey ) const isProposerEmoji = rule.definition.publishType === MeemAPI.PublishType.Proposal && rule.definition.proposalShareChannel !== channelId && proposerEmojis && proposerEmojis.some(e => - customEmoji ? e.name === customEmoji.name : e.unified === unicode + !emoji ? e.name === reaction.name : e.unified === reactionKey ) const isVetoerEmoji = vetoerEmojis && vetoerEmojis.some(e => - customEmoji ? e.name === customEmoji.name : e.unified === unicode + !emoji ? e.name === reaction.name : e.unified === reactionKey ) if (isApproverEmoji) { - if (!messageReactions.approver[unicode]) { - messageReactions.approver[unicode] = 0 + if (!messageReactions.approver[reactionKey]) { + messageReactions.approver[reactionKey] = 0 } - messageReactions.approver[unicode] += reaction.count ?? 0 + messageReactions.approver[reactionKey] += reaction.count ?? 0 } else if (isProposerEmoji) { - if (!messageReactions.proposer[unicode]) { - messageReactions.proposer[unicode] = 0 + if (!messageReactions.proposer[reactionKey]) { + messageReactions.proposer[reactionKey] = 0 } - messageReactions.proposer[unicode] += reaction.count ?? 0 + messageReactions.proposer[reactionKey] += reaction.count ?? 0 } else if (isVetoerEmoji) { - if (!messageReactions.vetoer[unicode]) { - messageReactions.vetoer[unicode] = 0 + if (!messageReactions.vetoer[reactionKey]) { + messageReactions.vetoer[reactionKey] = 0 } - messageReactions.vetoer[unicode] += reaction.count ?? 0 + messageReactions.vetoer[reactionKey] += reaction.count ?? 0 } } }) diff --git a/src/types/meem.generated.ts b/src/types/meem.generated.ts index 69db671d..4a0cf95a 100644 --- a/src/types/meem.generated.ts +++ b/src/types/meem.generated.ts @@ -850,7 +850,8 @@ export interface ISlackChannel { export enum MessageStatus { Pending = 'pending', - Handled = 'handled' + Handled = 'handled', + AwaitingApproval = 'awaitingApproval' } export interface IWebhookAttachment { @@ -1057,6 +1058,73 @@ export namespace Login { +export namespace AuthenticateWithDiscord { + export interface IPathParams {} + + export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` + + export const method = HttpMethod.Post + + export interface IQueryParams {} + + export interface IRequestBody { + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string + } + + export interface IResponseBody extends IApiResponseBody { + user: { [key: string]: any } + accessToken: string + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + +export namespace GetDiscordServers { + export interface IPathParams {} + + export const path = (options: IPathParams) => `/api/1.0/discord/servers` + + export const method = HttpMethod.Get + + export interface IQueryParams { + accessToken: string + } + + export interface IRequestBody { + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string + } + + export interface IResponseBody extends IApiResponseBody { + discordServers: IDiscordServer[] + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + /** Bulk mint agreement role tokens */ export namespace BulkBurnAgreementRoleTokens { export interface IPathParams { @@ -2072,73 +2140,6 @@ export namespace UpgradeAgreementRole { -export namespace AuthenticateWithDiscord { - export interface IPathParams {} - - export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } - - export interface IResponseBody extends IApiResponseBody { - user: { [key: string]: any } - accessToken: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace GetDiscordServers { - export interface IPathParams {} - - export const path = (options: IPathParams) => `/api/1.0/discord/servers` - - export const method = HttpMethod.Get - - export interface IQueryParams { - accessToken: string - } - - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } - - export interface IResponseBody extends IApiResponseBody { - discordServers: IDiscordServer[] - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - export namespace GetJoinGuildMessage { export interface IPathParams { /** The Agreement id */ diff --git a/src/types/meem.public.generated.ts b/src/types/meem.public.generated.ts index c5385699..2093e03f 100644 --- a/src/types/meem.public.generated.ts +++ b/src/types/meem.public.generated.ts @@ -850,7 +850,8 @@ export interface ISlackChannel { export enum MessageStatus { Pending = 'pending', - Handled = 'handled' + Handled = 'handled', + AwaitingApproval = 'awaitingApproval' } export interface IWebhookAttachment { @@ -1055,29 +1056,25 @@ export namespace Login { -/** Bulk mint agreement role tokens */ -export namespace BulkBurnAgreementRoleTokens { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - /** The id of the agreement role */ - agreementRoleId: string - } +export namespace AuthenticateWithDiscord { + export interface IPathParams {} - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkBurn` + export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - tokenIds: string[] + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + user: { [key: string]: any } + accessToken: string } export interface IDefinition { @@ -1092,28 +1089,26 @@ export namespace BulkBurnAgreementRoleTokens { +export namespace GetDiscordServers { + export interface IPathParams {} -/** Bulk mint agreement tokens */ -export namespace BulkBurnAgreementTokens { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/bulkBurn` + export const path = (options: IPathParams) => `/api/1.0/discord/servers` - export const method = HttpMethod.Post + export const method = HttpMethod.Get - export interface IQueryParams {} + export interface IQueryParams { + accessToken: string + } export interface IRequestBody { - tokenIds: string[] + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + discordServers: IDiscordServer[] } export interface IDefinition { @@ -1128,36 +1123,29 @@ export namespace BulkBurnAgreementTokens { +export namespace CreateBundle { + export interface IPathParams {} -/** Bulk mint agreement role tokens */ -export namespace BulkMintAgreementRoleTokens { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - /** The id of the agreement role */ - agreementRoleId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkMint` + export const path = () => `/api/1.0/epm/bundles` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - tokens: { - /** Token metadata */ - metadata?: IMeemMetadataLike - - /** The address where the token will be minted to. */ - to: string + name: string + description: string + // contractIds: string[] + contracts: { + id: string + functionSelectors: string[] }[] } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + bundleId: string + types: string + abi: Record[] } export interface IDefinition { @@ -1172,34 +1160,26 @@ export namespace BulkMintAgreementRoleTokens { +export namespace CreateContract { + export interface IPathParams {} -/** Bulk mint agreement tokens */ -export namespace BulkMintAgreementTokens { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/bulkMint` + export const path = () => `/api/1.0/epm/contracts` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - tokens: { - /** The token metadata */ - metadata?: IMeemMetadataLike - - /** The address where the token will be minted */ - to: string - }[] + name: string + description: string + contractType: ContractType + abi: any[] + bytecode: string } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + status: 'success' + contractId: string } export interface IDefinition { @@ -1214,25 +1194,22 @@ export namespace BulkMintAgreementTokens { +export namespace TrackContractInstance { + export interface IPathParams {} -/** Checks if the current user is an Agreement admin either by holding the Admin token or having the admin role on the contract */ -export namespace CheckIsAgreementAdmin { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/isAdmin` + export const path = () => `/api/1.0/epm/contractInstances` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + address: string + chainId: number + } export interface IResponseBody extends IApiResponseBody { - isAdmin: boolean + status: 'success' } export interface IDefinition { @@ -1247,99 +1224,60 @@ export namespace CheckIsAgreementAdmin { -/** Create an agreement contract. */ -export namespace CreateAgreement { - export interface IPathParams {} +export namespace UntrackContractInstance { + export interface IPathParams { + contractInstanceId: string + } - export const path = () => `/api/1.0/agreements` + export const path = (options: IPathParams) => + `/api/1.0/epm/contractInstances/${options.contractInstanceId}` - export const method = HttpMethod.Post + export const method = HttpMethod.Delete export interface IQueryParams {} - export interface IRequestBody { - /** The name of the contract */ - name: string - - /** Agreement contract metadata */ - metadata: IMeemMetadataLike - - /** If true, will deploy the contract on the chain. Default false */ - isOnChain?: boolean - - /** If true a contract will be deployed. Default false */ - shouldCreateContract?: boolean - - /** The contract chain id */ - chainId?: number - - /** The max number of tokens */ - maxSupply?: string - - /** Whether the max number of tokens is locked */ - isMaxSupplyLocked?: boolean + export interface IRequestBody {} - /** The contract symbol. If omitted, will use slug generated from name. */ - symbol?: string + export interface IResponseBody extends IApiResponseBody { + status: 'success' + } - /** Contract admin addresses */ - admins?: string[] + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } - /** Special minter permissions */ - minters?: string[] + export type Response = IResponseBody | IError +} - /** Minting permissions */ - mintPermissions?: Omit[] - /** Splits for minting / transfers */ - splits?: IMeemSplit[] - /** Whether tokens can be transferred */ - isTransferLocked?: boolean +export namespace UpdateBundle { + export interface IPathParams { + bundleId: string + } - /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ - shouldMintTokens?: boolean + export const path = (options: IPathParams) => + `/api/1.0/epm/bundles/${options.bundleId}` - /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ - members?: string[] + export const method = HttpMethod.Put - /** Token metadata to use if shouldMintTokens is true */ - tokenMetadata?: IMeemMetadataLike + export interface IQueryParams {} - /** If true, will create an admin role contract and set it as the admin contract for this agreement */ - shouldCreateAdminRole?: boolean + export interface IRequestBody { + name: string + description: string + contracts: { + id: string + functionSelectors: string[] + }[] } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for deploying the contract. Transaction #1 */ - deployContractTxId?: string - - /** The Transaction id for initializing the contract. Transaction #2 */ - cutTxId?: string - - /** The Transaction id for minting tokens. Transaction #3 */ - mintTxId?: string - - /** The Transaction id for deploying the admin role contract. Transaction #4 */ - adminRoleDeployContractTxId?: string - - /** The Transaction id for initializing the admin role contract. Transaction #5 */ - adminRoleCutTxId?: string - - /** The Transaction id for setting the role contract as the admin contract on the agreement. Transaction #6 */ - adminRoleSetAdminContractTxId?: string - - /** The Transaction id for minting admin role tokens. Transaction #7 */ - adminRoleMintTxId?: string - - /** The agreement id. Available only if isOnChain=false */ - agreementId?: string - - /** The admin agreement id. Available only if isOnChain=false */ - adminAgreementId?: string - - /** The slug for the agreement. Available only if isOnChain=false */ - slug?: string + types: string + abi: Record[] } export interface IDefinition { @@ -1354,60 +1292,25 @@ export namespace CreateAgreement { - -/** Create an agreement extension */ -export namespace CreateAgreementExtension { +export namespace UpdateWalletContractInstance { export interface IPathParams { - /** The id of the agreement */ - agreementId: string + contractInstanceId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/extensions` + `/api/1.0/epm/walletContractInstances/${options.contractInstanceId}` - export const method = HttpMethod.Post + export const method = HttpMethod.Patch export interface IQueryParams {} export interface IRequestBody { - /** The id of the extension to enable */ - extensionId: string - - /** Whether the extension initialization is complete */ - isInitialized?: boolean - - /** Whether the extension setup is complete */ - isSetupComplete?: boolean - - /** Optional metadata associated with this extension */ - metadata?: { - [key: string]: any - } - - /** Optional external link associated with this extension */ - externalLink?: { - /** Url for the link */ - url: string - /** The link label */ - label?: string - /** Visibility of the link extension */ - visibility?: AgreementExtensionVisibility - } - - /** Optional widget data associated with this extension */ - widget?: { - /** Metadata associated with the extension widget */ - metadata?: IMeemMetadataLike - /** Visibility of the widget extension */ - visibility?: AgreementExtensionVisibility - } + note: string + name: string } export interface IResponseBody extends IApiResponseBody { status: 'success' - - /** The Transaction ids that must be completed as part of creating the extension. May be empty if no transactions are required. */ - txIds: string[] } export interface IDefinition { @@ -1422,62 +1325,32 @@ export namespace CreateAgreementExtension { - -/** Create an agreement role contract */ -export namespace CreateAgreementRole { +export namespace GetJoinGuildMessage { export interface IPathParams { - /** The id of the agreement */ + /** The Agreement id */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles` + `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` - export const method = HttpMethod.Post + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - /** The name of the agreement role contract */ - name: string - - /** Agreement role contract metadata */ - metadata: IMeemMetadataLike - - /** The max number of tokens */ - maxSupply: string - - /** Whether the max supply is locked */ - isMaxSupplyLocked?: boolean - - /** The contract symbol. If omitted, will use slug generated from name */ - symbol?: string - - /** Splits for minting / transfers */ - splits?: IMeemSplit[] - - /** Whether tokens can be transferred */ - isTransferLocked?: boolean - - /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ - shouldMintTokens?: boolean - - /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ - members?: string[] - - /** Token metadata to use if shouldMintTokens is true */ - tokenMetadata?: IMeemMetadataLike - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for deploying the contract. Transaction #1 */ - deployContractTxId: string - - /** The Transaction id for initializing the contract. Transaction #2 */ - cutTxId: string - - /** The Transaction id for minting tokens. Transaction #3 */ - mintTxId?: string + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } } export interface IDefinition { @@ -1492,34 +1365,36 @@ export namespace CreateAgreementRole { - -/** Create an agreement safe */ -export namespace CreateAgreementSafe { +export namespace JoinGuild { export interface IPathParams { + /** The Agreement id */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/safe` + `/api/1.0/agreements/${options.agreementId}/joinGuild` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** Addresses of the safe owners */ - safeOwners: string[] - - /** Chain id of the safe */ - chainId?: number - - /** The number of signatures required */ - threshold?: number + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } + sig: string + mintToken?: boolean } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id */ - txId: string + status: 'success' } export interface IDefinition { @@ -1534,9 +1409,8 @@ export namespace CreateAgreementSafe { - -/** Delete an agreement role contract */ -export namespace DeleteAgreementRole { +/** Bulk mint agreement role tokens */ +export namespace BulkBurnAgreementRoleTokens { export interface IPathParams { /** The id of the agreement */ agreementId: string @@ -1545,16 +1419,19 @@ export namespace DeleteAgreementRole { } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkBurn` - export const method = HttpMethod.Delete + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + tokenIds: string[] + } export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1570,26 +1447,27 @@ export namespace DeleteAgreementRole { -/** Get an agreement role */ -export namespace GetAgreementRole { +/** Bulk mint agreement tokens */ +export namespace BulkBurnAgreementTokens { export interface IPathParams { /** The id of the agreement */ agreementId: string - /** The id of the agreement role */ - agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` + `/api/1.0/agreements/${options.agreementId}/bulkBurn` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + tokenIds: string[] + } export interface IResponseBody extends IApiResponseBody { - role: IAgreementRole + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1605,23 +1483,35 @@ export namespace GetAgreementRole { -export namespace GetAgreementRoles { +/** Bulk mint agreement role tokens */ +export namespace BulkMintAgreementRoleTokens { export interface IPathParams { - /** The Agreement id to fetch roles of */ + /** The id of the agreement */ agreementId: string + /** The id of the agreement role */ + agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkMint` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + tokens: { + /** Token metadata */ + metadata?: IMeemMetadataLike + + /** The address where the token will be minted to. */ + to: string + }[] + } export interface IResponseBody extends IApiResponseBody { - roles: any[] + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1637,24 +1527,33 @@ export namespace GetAgreementRoles { -/** Get agreement minting proof */ -export namespace GetMintingProof { +/** Bulk mint agreement tokens */ +export namespace BulkMintAgreementTokens { export interface IPathParams { /** The id of the agreement */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/proof` + `/api/1.0/agreements/${options.agreementId}/bulkMint` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + tokens: { + /** The token metadata */ + metadata?: IMeemMetadataLike + + /** The address where the token will be minted */ + to: string + }[] + } export interface IResponseBody extends IApiResponseBody { - proof: string[] + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1670,27 +1569,24 @@ export namespace GetMintingProof { -/** Check if agreement slug is available */ -export namespace IsSlugAvailable { - export interface IPathParams {} +/** Checks if the current user is an Agreement admin either by holding the Admin token or having the admin role on the contract */ +export namespace CheckIsAgreementAdmin { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + } export const path = (options: IPathParams) => - `/api/1.0/agreements/isSlugAvailable` + `/api/1.0/agreements/${options.agreementId}/isAdmin` - export const method = HttpMethod.Post + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - /** New agreement slug to check */ - slug: string - - /** The chain id of new agreement */ - chainId: number - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - isSlugAvailable: boolean + isAdmin: boolean } export interface IDefinition { @@ -1705,16 +1601,11 @@ export namespace IsSlugAvailable { +/** Create an agreement contract. */ +export namespace CreateAgreement { + export interface IPathParams {} -/** Reinitialize an agreement contract */ -export namespace ReInitializeAgreement { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/reinitialize` + export const path = () => `/api/1.0/agreements` export const method = HttpMethod.Post @@ -1722,15 +1613,27 @@ export namespace ReInitializeAgreement { export interface IRequestBody { /** The name of the contract */ - name?: string + name: string + + /** Agreement contract metadata */ + metadata: IMeemMetadataLike + + /** If true, will deploy the contract on the chain. Default false */ + isOnChain?: boolean + + /** If true a contract will be deployed. Default false */ + shouldCreateContract?: boolean + + /** The contract chain id */ + chainId?: number /** The max number of tokens */ maxSupply?: string - /** Agreement contract metadata */ - metadata?: IMeemMetadataLike + /** Whether the max number of tokens is locked */ + isMaxSupplyLocked?: boolean - /** The contract symbol. If omitted, will use slug generated from name */ + /** The contract symbol. If omitted, will use slug generated from name. */ symbol?: string /** Contract admin addresses */ @@ -1747,65 +1650,50 @@ export namespace ReInitializeAgreement { /** Whether tokens can be transferred */ isTransferLocked?: boolean - } - - export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for updating the contract. Only available if agreement is on chain */ - txId?: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} + /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ + shouldMintTokens?: boolean + /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ + members?: string[] + /** Token metadata to use if shouldMintTokens is true */ + tokenMetadata?: IMeemMetadataLike -/** Reinitialize an agreement contract */ -export namespace ReInitializeAgreementRole { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - /** The id of the agreement role */ - agreementRoleId: string + /** If true, will create an admin role contract and set it as the admin contract for this agreement */ + shouldCreateAdminRole?: boolean } - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/reinitialize` + export interface IResponseBody extends IApiResponseBody { + /** The Transaction id for deploying the contract. Transaction #1 */ + deployContractTxId?: string - export const method = HttpMethod.Post + /** The Transaction id for initializing the contract. Transaction #2 */ + cutTxId?: string - export interface IQueryParams {} + /** The Transaction id for minting tokens. Transaction #3 */ + mintTxId?: string - export interface IRequestBody { - /** The name of the contract */ - name?: string + /** The Transaction id for deploying the admin role contract. Transaction #4 */ + adminRoleDeployContractTxId?: string - /** The max number of tokens */ - maxSupply?: string + /** The Transaction id for initializing the admin role contract. Transaction #5 */ + adminRoleCutTxId?: string - /** Agreement role contract metadata */ - metadata?: IMeemMetadataLike + /** The Transaction id for setting the role contract as the admin contract on the agreement. Transaction #6 */ + adminRoleSetAdminContractTxId?: string - /** The contract symbol. If omitted, will use slug generated from name */ - symbol?: string + /** The Transaction id for minting admin role tokens. Transaction #7 */ + adminRoleMintTxId?: string - /** Splits for minting / transfers */ - splits?: IMeemSplit[] + /** The agreement id. Available only if isOnChain=false */ + agreementId?: string - /** Whether tokens can be transferred */ - isTransferLocked?: boolean - } + /** The admin agreement id. Available only if isOnChain=false */ + adminAgreementId?: string - export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for updating the contract. Only available if agreement is on chain */ - txId?: string + /** The slug for the agreement. Available only if isOnChain=false */ + slug?: string } export interface IDefinition { @@ -1821,64 +1709,59 @@ export namespace ReInitializeAgreementRole { -/** Set the agreement admin role */ -export namespace SetAgreementAdminRole { +/** Create an agreement extension */ +export namespace CreateAgreementExtension { export interface IPathParams { /** The id of the agreement */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/setAdminRole` + `/api/1.0/agreements/${options.agreementId}/extensions` - export const method = HttpMethod.Patch + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The id of the agreement role to set as admin role */ - adminAgreementRoleId: string - } - - export interface IResponseBody extends IApiResponseBody { - /** The Transaction id */ - txId: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } -} - - - - -/** Set the agreement safe address */ -export namespace SetAgreementSafeAddress { - export interface IPathParams { - agreementId: string - } + /** The id of the extension to enable */ + extensionId: string - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/safe` + /** Whether the extension initialization is complete */ + isInitialized?: boolean - export const method = HttpMethod.Patch + /** Whether the extension setup is complete */ + isSetupComplete?: boolean - export interface IQueryParams {} + /** Optional metadata associated with this extension */ + metadata?: { + [key: string]: any + } - export interface IRequestBody { - /** The safe address */ - address: string + /** Optional external link associated with this extension */ + externalLink?: { + /** Url for the link */ + url: string + /** The link label */ + label?: string + /** Visibility of the link extension */ + visibility?: AgreementExtensionVisibility + } - /** Chain id of the safe */ - chainId?: number + /** Optional widget data associated with this extension */ + widget?: { + /** Metadata associated with the extension widget */ + metadata?: IMeemMetadataLike + /** Visibility of the widget extension */ + visibility?: AgreementExtensionVisibility + } } export interface IResponseBody extends IApiResponseBody { status: 'success' + + /** The Transaction ids that must be completed as part of creating the extension. May be empty if no transactions are required. */ + txIds: string[] } export interface IDefinition { @@ -1894,27 +1777,61 @@ export namespace SetAgreementSafeAddress { -/** Update off-chain agreement data */ -export namespace UpdateAgreement { +/** Create an agreement role contract */ +export namespace CreateAgreementRole { export interface IPathParams { /** The id of the agreement */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}` + `/api/1.0/agreements/${options.agreementId}/roles` - export const method = HttpMethod.Patch + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** Whether the agreement is launched and visible to members */ - isLaunched: boolean + /** The name of the agreement role contract */ + name: string + + /** Agreement role contract metadata */ + metadata: IMeemMetadataLike + + /** The max number of tokens */ + maxSupply: string + + /** Whether the max supply is locked */ + isMaxSupplyLocked?: boolean + + /** The contract symbol. If omitted, will use slug generated from name */ + symbol?: string + + /** Splits for minting / transfers */ + splits?: IMeemSplit[] + + /** Whether tokens can be transferred */ + isTransferLocked?: boolean + + /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ + shouldMintTokens?: boolean + + /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ + members?: string[] + + /** Token metadata to use if shouldMintTokens is true */ + tokenMetadata?: IMeemMetadataLike } export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The Transaction id for deploying the contract. Transaction #1 */ + deployContractTxId: string + + /** The Transaction id for initializing the contract. Transaction #2 */ + cutTxId: string + + /** The Transaction id for minting tokens. Transaction #3 */ + mintTxId?: string } export interface IDefinition { @@ -1930,56 +1847,33 @@ export namespace UpdateAgreement { -/** Update an agreement extension */ -export namespace UpdateAgreementExtension { +/** Create an agreement safe */ +export namespace CreateAgreementSafe { export interface IPathParams { - /** The id of the agreement */ agreementId: string - - /** The agreement extension id */ - agreementExtensionId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/extensions/${options.agreementExtensionId}` + `/api/1.0/agreements/${options.agreementId}/safe` - export const method = HttpMethod.Put + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** Whether the extension initialization is complete */ - isInitialized?: boolean - /** Whether the extension setup is complete */ - isSetupComplete?: boolean - /** Optional metadata associated with this extension */ - metadata?: { - [key: string]: any - } | null - /** Optional external link associated with this extension */ - externalLink?: { - /** Url for the link */ - url: string - /** The link label */ - label?: string - /** Whether link should be enabled */ - isEnabled?: boolean - /** Visibility of the extension link */ - visibility?: AgreementExtensionVisibility - } | null - /** Optional widget data associated with this extension */ - widget?: { - /** Metadata associated with the extension widget */ - metadata?: IMeemMetadataLike - /** Whether widget should be enabled */ - isEnabled?: boolean - /** Visibility of the extension widget */ - visibility?: AgreementExtensionVisibility - } | null + /** Addresses of the safe owners */ + safeOwners: string[] + + /** Chain id of the safe */ + chainId?: number + + /** The number of signatures required */ + threshold?: number } export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The Transaction id */ + txId: string } export interface IDefinition { @@ -1995,27 +1889,26 @@ export namespace UpdateAgreementExtension { -/** Upgrade an agreement contract */ -export namespace UpgradeAgreement { +/** Delete an agreement role contract */ +export namespace DeleteAgreementRole { export interface IPathParams { + /** The id of the agreement */ agreementId: string + /** The id of the agreement role */ + agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/upgrade` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` - export const method = HttpMethod.Post + export const method = HttpMethod.Delete export interface IQueryParams {} - export interface IRequestBody { - /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ - bundleId?: string - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - /** The Transaction id */ - txId: string + status: 'success' } export interface IDefinition { @@ -2031,8 +1924,8 @@ export namespace UpgradeAgreement { -/** Upgrade an agreement role contract */ -export namespace UpgradeAgreementRole { +/** Get an agreement role */ +export namespace GetAgreementRole { export interface IPathParams { /** The id of the agreement */ agreementId: string @@ -2041,20 +1934,16 @@ export namespace UpgradeAgreementRole { } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/upgrade` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` - export const method = HttpMethod.Post + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ - bundleId?: string - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - /** The Transaction id */ - txId: string + role: IAgreementRole } export interface IDefinition { @@ -2070,25 +1959,23 @@ export namespace UpgradeAgreementRole { -export namespace AuthenticateWithDiscord { - export interface IPathParams {} +export namespace GetAgreementRoles { + export interface IPathParams { + /** The Agreement id to fetch roles of */ + agreementId: string + } - export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/roles` - export const method = HttpMethod.Post + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - user: { [key: string]: any } - accessToken: string + roles: any[] } export interface IDefinition { @@ -2103,26 +1990,25 @@ export namespace AuthenticateWithDiscord { -export namespace GetDiscordServers { - export interface IPathParams {} - export const path = (options: IPathParams) => `/api/1.0/discord/servers` +/** Get agreement minting proof */ +export namespace GetMintingProof { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/proof` export const method = HttpMethod.Get - export interface IQueryParams { - accessToken: string - } + export interface IQueryParams {} - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - discordServers: IDiscordServer[] + proof: string[] } export interface IDefinition { @@ -2137,32 +2023,28 @@ export namespace GetDiscordServers { -export namespace GetJoinGuildMessage { - export interface IPathParams { - /** The Agreement id */ - agreementId: string - } + +/** Check if agreement slug is available */ +export namespace IsSlugAvailable { + export interface IPathParams {} export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` + `/api/1.0/agreements/isSlugAvailable` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** New agreement slug to check */ + slug: string + + /** The chain id of new agreement */ + chainId: number + } export interface IResponseBody extends IApiResponseBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } + isSlugAvailable: boolean } export interface IDefinition { @@ -2177,36 +2059,53 @@ export namespace GetJoinGuildMessage { -export namespace JoinGuild { + +/** Reinitialize an agreement contract */ +export namespace ReInitializeAgreement { export interface IPathParams { - /** The Agreement id */ + /** The id of the agreement */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/joinGuild` + `/api/1.0/agreements/${options.agreementId}/reinitialize` export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } - sig: string - mintToken?: boolean + export interface IRequestBody { + /** The name of the contract */ + name?: string + + /** The max number of tokens */ + maxSupply?: string + + /** Agreement contract metadata */ + metadata?: IMeemMetadataLike + + /** The contract symbol. If omitted, will use slug generated from name */ + symbol?: string + + /** Contract admin addresses */ + admins?: string[] + + /** Special minter permissions */ + minters?: string[] + + /** Minting permissions */ + mintPermissions?: Omit[] + + /** Splits for minting / transfers */ + splits?: IMeemSplit[] + + /** Whether tokens can be transferred */ + isTransferLocked?: boolean } export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The Transaction id for updating the contract. Only available if agreement is on chain */ + txId?: string } export interface IDefinition { @@ -2221,29 +2120,46 @@ export namespace JoinGuild { -export namespace CreateBundle { - export interface IPathParams {} - export const path = () => `/api/1.0/epm/bundles` +/** Reinitialize an agreement contract */ +export namespace ReInitializeAgreementRole { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + /** The id of the agreement role */ + agreementRoleId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/reinitialize` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - name: string - description: string - // contractIds: string[] - contracts: { - id: string - functionSelectors: string[] - }[] + /** The name of the contract */ + name?: string + + /** The max number of tokens */ + maxSupply?: string + + /** Agreement role contract metadata */ + metadata?: IMeemMetadataLike + + /** The contract symbol. If omitted, will use slug generated from name */ + symbol?: string + + /** Splits for minting / transfers */ + splits?: IMeemSplit[] + + /** Whether tokens can be transferred */ + isTransferLocked?: boolean } export interface IResponseBody extends IApiResponseBody { - bundleId: string - types: string - abi: Record[] + /** The Transaction id for updating the contract. Only available if agreement is on chain */ + txId?: string } export interface IDefinition { @@ -2258,26 +2174,29 @@ export namespace CreateBundle { -export namespace CreateContract { - export interface IPathParams {} - export const path = () => `/api/1.0/epm/contracts` +/** Set the agreement admin role */ +export namespace SetAgreementAdminRole { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + } - export const method = HttpMethod.Post + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/setAdminRole` + + export const method = HttpMethod.Patch export interface IQueryParams {} export interface IRequestBody { - name: string - description: string - contractType: ContractType - abi: any[] - bytecode: string + /** The id of the agreement role to set as admin role */ + adminAgreementRoleId: string } export interface IResponseBody extends IApiResponseBody { - status: 'success' - contractId: string + /** The Transaction id */ + txId: string } export interface IDefinition { @@ -2286,24 +2205,30 @@ export namespace CreateContract { requestBody: IRequestBody responseBody: IResponseBody } - - export type Response = IResponseBody | IError } -export namespace TrackContractInstance { - export interface IPathParams {} - export const path = () => `/api/1.0/epm/contractInstances` +/** Set the agreement safe address */ +export namespace SetAgreementSafeAddress { + export interface IPathParams { + agreementId: string + } - export const method = HttpMethod.Post + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/safe` + + export const method = HttpMethod.Patch export interface IQueryParams {} export interface IRequestBody { + /** The safe address */ address: string - chainId: number + + /** Chain id of the safe */ + chainId?: number } export interface IResponseBody extends IApiResponseBody { @@ -2322,19 +2247,25 @@ export namespace TrackContractInstance { -export namespace UntrackContractInstance { + +/** Update off-chain agreement data */ +export namespace UpdateAgreement { export interface IPathParams { - contractInstanceId: string + /** The id of the agreement */ + agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/epm/contractInstances/${options.contractInstanceId}` + `/api/1.0/agreements/${options.agreementId}` - export const method = HttpMethod.Delete + export const method = HttpMethod.Patch export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** Whether the agreement is launched and visible to members */ + isLaunched: boolean + } export interface IResponseBody extends IApiResponseBody { status: 'success' @@ -2352,30 +2283,57 @@ export namespace UntrackContractInstance { -export namespace UpdateBundle { + +/** Update an agreement extension */ +export namespace UpdateAgreementExtension { export interface IPathParams { - bundleId: string + /** The id of the agreement */ + agreementId: string + + /** The agreement extension id */ + agreementExtensionId: string } export const path = (options: IPathParams) => - `/api/1.0/epm/bundles/${options.bundleId}` + `/api/1.0/agreements/${options.agreementId}/extensions/${options.agreementExtensionId}` export const method = HttpMethod.Put export interface IQueryParams {} export interface IRequestBody { - name: string - description: string - contracts: { - id: string - functionSelectors: string[] - }[] + /** Whether the extension initialization is complete */ + isInitialized?: boolean + /** Whether the extension setup is complete */ + isSetupComplete?: boolean + /** Optional metadata associated with this extension */ + metadata?: { + [key: string]: any + } | null + /** Optional external link associated with this extension */ + externalLink?: { + /** Url for the link */ + url: string + /** The link label */ + label?: string + /** Whether link should be enabled */ + isEnabled?: boolean + /** Visibility of the extension link */ + visibility?: AgreementExtensionVisibility + } | null + /** Optional widget data associated with this extension */ + widget?: { + /** Metadata associated with the extension widget */ + metadata?: IMeemMetadataLike + /** Whether widget should be enabled */ + isEnabled?: boolean + /** Visibility of the extension widget */ + visibility?: AgreementExtensionVisibility + } | null } export interface IResponseBody extends IApiResponseBody { - types: string - abi: Record[] + status: 'success' } export interface IDefinition { @@ -2390,25 +2348,28 @@ export namespace UpdateBundle { -export namespace UpdateWalletContractInstance { + +/** Upgrade an agreement contract */ +export namespace UpgradeAgreement { export interface IPathParams { - contractInstanceId: string + agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/epm/walletContractInstances/${options.contractInstanceId}` + `/api/1.0/agreements/${options.agreementId}/upgrade` - export const method = HttpMethod.Patch + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - note: string - name: string + /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ + bundleId?: string } export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The Transaction id */ + txId: string } export interface IDefinition { @@ -2423,27 +2384,31 @@ export namespace UpdateWalletContractInstance { -/** Save some data to IPFS */ -export namespace SaveToIPFS { - export interface IPathParams {} - export const path = () => `/api/1.0/ipfs` +/** Upgrade an agreement role contract */ +export namespace UpgradeAgreementRole { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + /** The id of the agreement role */ + agreementRoleId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/upgrade` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The data to save. Only one of "data" or "json" should be sent */ - data?: string - - /** The JSON to save. Only one of "data" or "json" should be sent */ - json?: Record + /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ + bundleId?: string } export interface IResponseBody extends IApiResponseBody { - /** The IPFS hash for the saved data */ - ipfsHash: string + /** The Transaction id */ + txId: string } export interface IDefinition { @@ -2456,8 +2421,6 @@ export namespace SaveToIPFS { export type Response = IResponseBody | IError } -// TODO: How to specify json in OpenAPI definition - @@ -2660,6 +2623,44 @@ export namespace UpdateUserIdentity { +/** Save some data to IPFS */ +export namespace SaveToIPFS { + export interface IPathParams {} + + export const path = () => `/api/1.0/ipfs` + + export const method = HttpMethod.Post + + export interface IQueryParams {} + + export interface IRequestBody { + /** The data to save. Only one of "data" or "json" should be sent */ + data?: string + + /** The JSON to save. Only one of "data" or "json" should be sent */ + json?: Record + } + + export interface IResponseBody extends IApiResponseBody { + /** The IPFS hash for the saved data */ + ipfsHash: string + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + +// TODO: How to specify json in OpenAPI definition + + + + /** Redirect the user to this endpoint to authenticate w/ slack */ export namespace AuthenticateWithSlack { export interface IPathParams {} diff --git a/src/types/shared/symphony.shared.ts b/src/types/shared/symphony.shared.ts index 366279d2..4d93e39a 100644 --- a/src/types/shared/symphony.shared.ts +++ b/src/types/shared/symphony.shared.ts @@ -81,7 +81,8 @@ export interface ISlackChannel { export enum MessageStatus { Pending = 'pending', - Handled = 'handled' + Handled = 'handled', + AwaitingApproval = 'awaitingApproval' } export interface IWebhookAttachment { From afe072eb6c3d903be4d40ddc44ad95764d9bce9d Mon Sep 17 00:00:00 2001 From: Ken Goldfarb Date: Tue, 2 May 2023 12:08:23 -0600 Subject: [PATCH 3/5] latest --- src/services/Discord.ts | 1 - src/types/meem.generated.ts | 216 ++++---- src/types/meem.public.generated.ts | 838 ++++++++++++++--------------- 3 files changed, 527 insertions(+), 528 deletions(-) diff --git a/src/services/Discord.ts b/src/services/Discord.ts index 3128f140..9f60b4dd 100644 --- a/src/services/Discord.ts +++ b/src/services/Discord.ts @@ -421,7 +421,6 @@ export default class Discord { channelId: message.channelId, rule, message - }) } } diff --git a/src/types/meem.generated.ts b/src/types/meem.generated.ts index 4a0cf95a..9a63e621 100644 --- a/src/types/meem.generated.ts +++ b/src/types/meem.generated.ts @@ -1058,73 +1058,6 @@ export namespace Login { -export namespace AuthenticateWithDiscord { - export interface IPathParams {} - - export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } - - export interface IResponseBody extends IApiResponseBody { - user: { [key: string]: any } - accessToken: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace GetDiscordServers { - export interface IPathParams {} - - export const path = (options: IPathParams) => `/api/1.0/discord/servers` - - export const method = HttpMethod.Get - - export interface IQueryParams { - accessToken: string - } - - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } - - export interface IResponseBody extends IApiResponseBody { - discordServers: IDiscordServer[] - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - /** Bulk mint agreement role tokens */ export namespace BulkBurnAgreementRoleTokens { export interface IPathParams { @@ -2140,32 +2073,25 @@ export namespace UpgradeAgreementRole { -export namespace GetJoinGuildMessage { - export interface IPathParams { - /** The Agreement id */ - agreementId: string - } +export namespace AuthenticateWithDiscord { + export interface IPathParams {} - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` + export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string + } export interface IResponseBody extends IApiResponseBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } + user: { [key: string]: any } + accessToken: string } export interface IDefinition { @@ -2180,36 +2106,26 @@ export namespace GetJoinGuildMessage { -export namespace JoinGuild { - export interface IPathParams { - /** The Agreement id */ - agreementId: string - } +export namespace GetDiscordServers { + export interface IPathParams {} - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/joinGuild` + export const path = (options: IPathParams) => `/api/1.0/discord/servers` - export const method = HttpMethod.Post + export const method = HttpMethod.Get - export interface IQueryParams {} + export interface IQueryParams { + accessToken: string + } export interface IRequestBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } - sig: string - mintToken?: boolean + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string } export interface IResponseBody extends IApiResponseBody { - status: 'success' + discordServers: IDiscordServer[] } export interface IDefinition { @@ -2426,6 +2342,90 @@ export namespace UpdateWalletContractInstance { +export namespace GetJoinGuildMessage { + export interface IPathParams { + /** The Agreement id */ + agreementId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` + + export const method = HttpMethod.Get + + export interface IQueryParams {} + + export interface IRequestBody {} + + export interface IResponseBody extends IApiResponseBody { + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + +export namespace JoinGuild { + export interface IPathParams { + /** The Agreement id */ + agreementId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/joinGuild` + + export const method = HttpMethod.Post + + export interface IQueryParams {} + + export interface IRequestBody { + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } + sig: string + mintToken?: boolean + } + + export interface IResponseBody extends IApiResponseBody { + status: 'success' + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + /** Create or update the current user */ export namespace CreateOrUpdateUser { export interface IPathParams {} diff --git a/src/types/meem.public.generated.ts b/src/types/meem.public.generated.ts index 2093e03f..2fbb4386 100644 --- a/src/types/meem.public.generated.ts +++ b/src/types/meem.public.generated.ts @@ -1056,359 +1056,6 @@ export namespace Login { -export namespace AuthenticateWithDiscord { - export interface IPathParams {} - - export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } - - export interface IResponseBody extends IApiResponseBody { - user: { [key: string]: any } - accessToken: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace GetDiscordServers { - export interface IPathParams {} - - export const path = (options: IPathParams) => `/api/1.0/discord/servers` - - export const method = HttpMethod.Get - - export interface IQueryParams { - accessToken: string - } - - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } - - export interface IResponseBody extends IApiResponseBody { - discordServers: IDiscordServer[] - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace CreateBundle { - export interface IPathParams {} - - export const path = () => `/api/1.0/epm/bundles` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - name: string - description: string - // contractIds: string[] - contracts: { - id: string - functionSelectors: string[] - }[] - } - - export interface IResponseBody extends IApiResponseBody { - bundleId: string - types: string - abi: Record[] - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace CreateContract { - export interface IPathParams {} - - export const path = () => `/api/1.0/epm/contracts` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - name: string - description: string - contractType: ContractType - abi: any[] - bytecode: string - } - - export interface IResponseBody extends IApiResponseBody { - status: 'success' - contractId: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace TrackContractInstance { - export interface IPathParams {} - - export const path = () => `/api/1.0/epm/contractInstances` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - address: string - chainId: number - } - - export interface IResponseBody extends IApiResponseBody { - status: 'success' - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace UntrackContractInstance { - export interface IPathParams { - contractInstanceId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/epm/contractInstances/${options.contractInstanceId}` - - export const method = HttpMethod.Delete - - export interface IQueryParams {} - - export interface IRequestBody {} - - export interface IResponseBody extends IApiResponseBody { - status: 'success' - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace UpdateBundle { - export interface IPathParams { - bundleId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/epm/bundles/${options.bundleId}` - - export const method = HttpMethod.Put - - export interface IQueryParams {} - - export interface IRequestBody { - name: string - description: string - contracts: { - id: string - functionSelectors: string[] - }[] - } - - export interface IResponseBody extends IApiResponseBody { - types: string - abi: Record[] - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace UpdateWalletContractInstance { - export interface IPathParams { - contractInstanceId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/epm/walletContractInstances/${options.contractInstanceId}` - - export const method = HttpMethod.Patch - - export interface IQueryParams {} - - export interface IRequestBody { - note: string - name: string - } - - export interface IResponseBody extends IApiResponseBody { - status: 'success' - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace GetJoinGuildMessage { - export interface IPathParams { - /** The Agreement id */ - agreementId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` - - export const method = HttpMethod.Get - - export interface IQueryParams {} - - export interface IRequestBody {} - - export interface IResponseBody extends IApiResponseBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace JoinGuild { - export interface IPathParams { - /** The Agreement id */ - agreementId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/joinGuild` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } - sig: string - mintToken?: boolean - } - - export interface IResponseBody extends IApiResponseBody { - status: 'success' - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - /** Bulk mint agreement role tokens */ export namespace BulkBurnAgreementRoleTokens { export interface IPathParams { @@ -2424,27 +2071,25 @@ export namespace UpgradeAgreementRole { -/** Create or update the current user */ -export namespace CreateOrUpdateUser { +export namespace AuthenticateWithDiscord { export interface IPathParams {} - export const path = () => `/api/1.0/me` + export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** Profile picture base64 string */ - profilePicBase64?: string - /** Url to profile picture */ - // profilePicUrl?: string - /** Display name of identity */ - displayName?: string + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string } export interface IResponseBody extends IApiResponseBody { - user: IMeemUser + user: { [key: string]: any } + accessToken: string } export interface IDefinition { @@ -2459,20 +2104,26 @@ export namespace CreateOrUpdateUser { - -export namespace GetApiKey { +export namespace GetDiscordServers { export interface IPathParams {} - export const path = () => `/api/1.0/me/apiKey` + export const path = (options: IPathParams) => `/api/1.0/discord/servers` export const method = HttpMethod.Get - export interface IQueryParams {} + export interface IQueryParams { + accessToken: string + } - export interface IRequestBody {} + export interface IRequestBody { + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string + } export interface IResponseBody extends IApiResponseBody { - jwt: string + discordServers: IDiscordServer[] } export interface IDefinition { @@ -2487,27 +2138,67 @@ export namespace GetApiKey { -/** Get the current authenticated user */ -export namespace GetMe { +/** Save some data to IPFS */ +export namespace SaveToIPFS { export interface IPathParams {} - export const path = () => `/api/1.0/me` + export const path = () => `/api/1.0/ipfs` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** The data to save. Only one of "data" or "json" should be sent */ + data?: string + + /** The JSON to save. Only one of "data" or "json" should be sent */ + json?: Record + } export interface IResponseBody extends IApiResponseBody { - /** The authenticated user's wallet id */ - walletId: string + /** The IPFS hash for the saved data */ + ipfsHash: string + } - /** The authenticated user's wallet address */ - address: string + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } - /** The authenticated user */ - user: IMeemUser + export type Response = IResponseBody | IError +} + +// TODO: How to specify json in OpenAPI definition + + + + +export namespace CreateBundle { + export interface IPathParams {} + + export const path = () => `/api/1.0/epm/bundles` + + export const method = HttpMethod.Post + + export interface IQueryParams {} + + export interface IRequestBody { + name: string + description: string + // contractIds: string[] + contracts: { + id: string + functionSelectors: string[] + }[] + } + + export interface IResponseBody extends IApiResponseBody { + bundleId: string + types: string + abi: Record[] } export interface IDefinition { @@ -2522,21 +2213,26 @@ export namespace GetMe { - -/** Refresh the ENS name for the current user's wallet address */ -export namespace RefreshENS { +export namespace CreateContract { export interface IPathParams {} - export const path = () => `/api/1.0/me/refreshENS` + export const path = () => `/api/1.0/epm/contracts` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + name: string + description: string + contractType: ContractType + abi: any[] + bytecode: string + } export interface IResponseBody extends IApiResponseBody { status: 'success' + contractId: string } export interface IDefinition { @@ -2551,16 +2247,43 @@ export namespace RefreshENS { +export namespace TrackContractInstance { + export interface IPathParams {} + + export const path = () => `/api/1.0/epm/contractInstances` + + export const method = HttpMethod.Post + + export interface IQueryParams {} -/** Remove a user identity from the current user */ -export namespace RemoveUserIdentity { + export interface IRequestBody { + address: string + chainId: number + } + + export interface IResponseBody extends IApiResponseBody { + status: 'success' + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + +export namespace UntrackContractInstance { export interface IPathParams { - /** The id of the user identity to remove */ - userIdentityId: string + contractInstanceId: string } export const path = (options: IPathParams) => - `/api/1.0/me/identity/${options.userIdentityId}` + `/api/1.0/epm/contractInstances/${options.contractInstanceId}` export const method = HttpMethod.Delete @@ -2584,30 +2307,103 @@ export namespace RemoveUserIdentity { +export namespace UpdateBundle { + export interface IPathParams { + bundleId: string + } -/** Update current user identity */ -export namespace UpdateUserIdentity { + export const path = (options: IPathParams) => + `/api/1.0/epm/bundles/${options.bundleId}` + + export const method = HttpMethod.Put + + export interface IQueryParams {} + + export interface IRequestBody { + name: string + description: string + contracts: { + id: string + functionSelectors: string[] + }[] + } + + export interface IResponseBody extends IApiResponseBody { + types: string + abi: Record[] + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + +export namespace UpdateWalletContractInstance { export interface IPathParams { - /** The id of the user identity to update */ - userIdentityId: string + contractInstanceId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/epm/walletContractInstances/${options.contractInstanceId}` + + export const method = HttpMethod.Patch + + export interface IQueryParams {} + + export interface IRequestBody { + note: string + name: string + } + + export interface IResponseBody extends IApiResponseBody { + status: 'success' + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + +export namespace GetJoinGuildMessage { + export interface IPathParams { + /** The Agreement id */ + agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/me/identity/${options.userIdentityId}` + `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` - export const method = HttpMethod.Patch + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - /** Set the visibility type of the user identity */ - visibility?: IUserIdentityVisibility - /** Metadata associated with this user identity */ - metadata?: { [key: string]: unknown } - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - userIdentity: any + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } } export interface IDefinition { @@ -2622,28 +2418,36 @@ export namespace UpdateUserIdentity { +export namespace JoinGuild { + export interface IPathParams { + /** The Agreement id */ + agreementId: string + } -/** Save some data to IPFS */ -export namespace SaveToIPFS { - export interface IPathParams {} - - export const path = () => `/api/1.0/ipfs` + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/joinGuild` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The data to save. Only one of "data" or "json" should be sent */ - data?: string - - /** The JSON to save. Only one of "data" or "json" should be sent */ - json?: Record + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } + sig: string + mintToken?: boolean } export interface IResponseBody extends IApiResponseBody { - /** The IPFS hash for the saved data */ - ipfsHash: string + status: 'success' } export interface IDefinition { @@ -2656,9 +2460,6 @@ export namespace SaveToIPFS { export type Response = IResponseBody | IError } -// TODO: How to specify json in OpenAPI definition - - /** Redirect the user to this endpoint to authenticate w/ slack */ @@ -3090,6 +2891,205 @@ export namespace SlackAuthCallback { export type Response = IResponseBody | IError } + + +/** Create or update the current user */ +export namespace CreateOrUpdateUser { + export interface IPathParams {} + + export const path = () => `/api/1.0/me` + + export const method = HttpMethod.Post + + export interface IQueryParams {} + + export interface IRequestBody { + /** Profile picture base64 string */ + profilePicBase64?: string + /** Url to profile picture */ + // profilePicUrl?: string + /** Display name of identity */ + displayName?: string + } + + export interface IResponseBody extends IApiResponseBody { + user: IMeemUser + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + + +export namespace GetApiKey { + export interface IPathParams {} + + export const path = () => `/api/1.0/me/apiKey` + + export const method = HttpMethod.Get + + export interface IQueryParams {} + + export interface IRequestBody {} + + export interface IResponseBody extends IApiResponseBody { + jwt: string + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + +/** Get the current authenticated user */ +export namespace GetMe { + export interface IPathParams {} + + export const path = () => `/api/1.0/me` + + export const method = HttpMethod.Get + + export interface IQueryParams {} + + export interface IRequestBody {} + + export interface IResponseBody extends IApiResponseBody { + /** The authenticated user's wallet id */ + walletId: string + + /** The authenticated user's wallet address */ + address: string + + /** The authenticated user */ + user: IMeemUser + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + + +/** Refresh the ENS name for the current user's wallet address */ +export namespace RefreshENS { + export interface IPathParams {} + + export const path = () => `/api/1.0/me/refreshENS` + + export const method = HttpMethod.Get + + export interface IQueryParams {} + + export interface IRequestBody {} + + export interface IResponseBody extends IApiResponseBody { + status: 'success' + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + + +/** Remove a user identity from the current user */ +export namespace RemoveUserIdentity { + export interface IPathParams { + /** The id of the user identity to remove */ + userIdentityId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/me/identity/${options.userIdentityId}` + + export const method = HttpMethod.Delete + + export interface IQueryParams {} + + export interface IRequestBody {} + + export interface IResponseBody extends IApiResponseBody { + status: 'success' + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + + +/** Update current user identity */ +export namespace UpdateUserIdentity { + export interface IPathParams { + /** The id of the user identity to update */ + userIdentityId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/me/identity/${options.userIdentityId}` + + export const method = HttpMethod.Patch + + export interface IQueryParams {} + + export interface IRequestBody { + /** Set the visibility type of the user identity */ + visibility?: IUserIdentityVisibility + /** Metadata associated with this user identity */ + metadata?: { [key: string]: unknown } + } + + export interface IResponseBody extends IApiResponseBody { + userIdentity: any + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + } export enum MeemEvent { From 5fbba221563b4f0803c097f7228d72c786c1f701 Mon Sep 17 00:00:00 2001 From: Ken Goldfarb Date: Wed, 3 May 2023 10:59:47 -0600 Subject: [PATCH 4/5] latest --- src/types/meem.generated.ts | 302 ++++++++++++++++++------------------ 1 file changed, 151 insertions(+), 151 deletions(-) diff --git a/src/types/meem.generated.ts b/src/types/meem.generated.ts index 880a20dc..7580e863 100644 --- a/src/types/meem.generated.ts +++ b/src/types/meem.generated.ts @@ -1057,73 +1057,6 @@ export namespace Login { -export namespace AuthenticateWithDiscord { - export interface IPathParams {} - - export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } - - export interface IResponseBody extends IApiResponseBody { - user: { [key: string]: any } - accessToken: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace GetDiscordServers { - export interface IPathParams {} - - export const path = (options: IPathParams) => `/api/1.0/discord/servers` - - export const method = HttpMethod.Get - - export interface IQueryParams { - accessToken: string - } - - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } - - export interface IResponseBody extends IApiResponseBody { - discordServers: IDiscordServer[] - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - /** Bulk mint agreement role tokens */ export namespace BulkBurnAgreementRoleTokens { export interface IPathParams { @@ -2139,29 +2072,25 @@ export namespace UpgradeAgreementRole { -export namespace CreateBundle { +export namespace AuthenticateWithDiscord { export interface IPathParams {} - export const path = () => `/api/1.0/epm/bundles` + export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - name: string - description: string - // contractIds: string[] - contracts: { - id: string - functionSelectors: string[] - }[] + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string } export interface IResponseBody extends IApiResponseBody { - bundleId: string - types: string - abi: Record[] + user: { [key: string]: any } + accessToken: string } export interface IDefinition { @@ -2176,26 +2105,26 @@ export namespace CreateBundle { -export namespace CreateContract { +export namespace GetDiscordServers { export interface IPathParams {} - export const path = () => `/api/1.0/epm/contracts` + export const path = (options: IPathParams) => `/api/1.0/discord/servers` - export const method = HttpMethod.Post + export const method = HttpMethod.Get - export interface IQueryParams {} + export interface IQueryParams { + accessToken: string + } export interface IRequestBody { - name: string - description: string - contractType: ContractType - abi: any[] - bytecode: string + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string } export interface IResponseBody extends IApiResponseBody { - status: 'success' - contractId: string + discordServers: IDiscordServer[] } export interface IDefinition { @@ -2210,22 +2139,32 @@ export namespace CreateContract { -export namespace TrackContractInstance { - export interface IPathParams {} +export namespace GetJoinGuildMessage { + export interface IPathParams { + /** The Agreement id */ + agreementId: string + } - export const path = () => `/api/1.0/epm/contractInstances` + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` - export const method = HttpMethod.Post + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - address: string - chainId: number - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - status: 'success' + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } } export interface IDefinition { @@ -2240,19 +2179,33 @@ export namespace TrackContractInstance { -export namespace UntrackContractInstance { +export namespace JoinGuild { export interface IPathParams { - contractInstanceId: string + /** The Agreement id */ + agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/epm/contractInstances/${options.contractInstanceId}` + `/api/1.0/agreements/${options.agreementId}/joinGuild` - export const method = HttpMethod.Delete + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } + sig: string + mintToken?: boolean + } export interface IResponseBody extends IApiResponseBody { status: 'success' @@ -2270,21 +2223,19 @@ export namespace UntrackContractInstance { -export namespace UpdateBundle { - export interface IPathParams { - bundleId: string - } +export namespace CreateBundle { + export interface IPathParams {} - export const path = (options: IPathParams) => - `/api/1.0/epm/bundles/${options.bundleId}` + export const path = () => `/api/1.0/epm/bundles` - export const method = HttpMethod.Put + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { name: string description: string + // contractIds: string[] contracts: { id: string functionSelectors: string[] @@ -2292,6 +2243,7 @@ export namespace UpdateBundle { } export interface IResponseBody extends IApiResponseBody { + bundleId: string types: string abi: Record[] } @@ -2308,25 +2260,26 @@ export namespace UpdateBundle { -export namespace UpdateWalletContractInstance { - export interface IPathParams { - contractInstanceId: string - } +export namespace CreateContract { + export interface IPathParams {} - export const path = (options: IPathParams) => - `/api/1.0/epm/walletContractInstances/${options.contractInstanceId}` + export const path = () => `/api/1.0/epm/contracts` - export const method = HttpMethod.Patch + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - note: string name: string + description: string + contractType: ContractType + abi: any[] + bytecode: string } export interface IResponseBody extends IApiResponseBody { status: 'success' + contractId: string } export interface IDefinition { @@ -2341,32 +2294,52 @@ export namespace UpdateWalletContractInstance { -export namespace GetJoinGuildMessage { +export namespace TrackContractInstance { + export interface IPathParams {} + + export const path = () => `/api/1.0/epm/contractInstances` + + export const method = HttpMethod.Post + + export interface IQueryParams {} + + export interface IRequestBody { + address: string + chainId: number + } + + export interface IResponseBody extends IApiResponseBody { + status: 'success' + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + +export namespace UntrackContractInstance { export interface IPathParams { - /** The Agreement id */ - agreementId: string + contractInstanceId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` + `/api/1.0/epm/contractInstances/${options.contractInstanceId}` - export const method = HttpMethod.Get + export const method = HttpMethod.Delete export interface IQueryParams {} export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } + status: 'success' } export interface IDefinition { @@ -2381,32 +2354,59 @@ export namespace GetJoinGuildMessage { -export namespace JoinGuild { +export namespace UpdateBundle { export interface IPathParams { - /** The Agreement id */ - agreementId: string + bundleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/joinGuild` + `/api/1.0/epm/bundles/${options.bundleId}` - export const method = HttpMethod.Post + export const method = HttpMethod.Put export interface IQueryParams {} export interface IRequestBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } - sig: string - mintToken?: boolean + name: string + description: string + contracts: { + id: string + functionSelectors: string[] + }[] + } + + export interface IResponseBody extends IApiResponseBody { + types: string + abi: Record[] + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + +export namespace UpdateWalletContractInstance { + export interface IPathParams { + contractInstanceId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/epm/walletContractInstances/${options.contractInstanceId}` + + export const method = HttpMethod.Patch + + export interface IQueryParams {} + + export interface IRequestBody { + note: string + name: string } export interface IResponseBody extends IApiResponseBody { From 12973e1e2c5755786bd02358206864f7e2c65471 Mon Sep 17 00:00:00 2001 From: Ken Goldfarb Date: Wed, 3 May 2023 11:12:48 -0600 Subject: [PATCH 5/5] lint --- src/types/meem.generated.ts | 1081 ++++++++++++++-------------- src/types/meem.public.generated.ts | 587 +++++++-------- 2 files changed, 835 insertions(+), 833 deletions(-) diff --git a/src/types/meem.generated.ts b/src/types/meem.generated.ts index 9a63e621..8f77c54c 100644 --- a/src/types/meem.generated.ts +++ b/src/types/meem.generated.ts @@ -893,6 +893,7 @@ export interface IWebhookBody { totalVetoers: number reactions: IWebhookReaction[] createdTimestamp?: number + inputMetadata?: any } @@ -1058,29 +1059,25 @@ export namespace Login { -/** Bulk mint agreement role tokens */ -export namespace BulkBurnAgreementRoleTokens { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - /** The id of the agreement role */ - agreementRoleId: string - } +export namespace AuthenticateWithDiscord { + export interface IPathParams {} - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkBurn` + export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - tokenIds: string[] + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + user: { [key: string]: any } + accessToken: string } export interface IDefinition { @@ -1095,28 +1092,26 @@ export namespace BulkBurnAgreementRoleTokens { +export namespace GetDiscordServers { + export interface IPathParams {} -/** Bulk mint agreement tokens */ -export namespace BulkBurnAgreementTokens { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/bulkBurn` + export const path = (options: IPathParams) => `/api/1.0/discord/servers` - export const method = HttpMethod.Post + export const method = HttpMethod.Get - export interface IQueryParams {} + export interface IQueryParams { + accessToken: string + } export interface IRequestBody { - tokenIds: string[] + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + discordServers: IDiscordServer[] } export interface IDefinition { @@ -1131,36 +1126,32 @@ export namespace BulkBurnAgreementTokens { - -/** Bulk mint agreement role tokens */ -export namespace BulkMintAgreementRoleTokens { +export namespace GetJoinGuildMessage { export interface IPathParams { - /** The id of the agreement */ + /** The Agreement id */ agreementId: string - /** The id of the agreement role */ - agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkMint` + `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` - export const method = HttpMethod.Post + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - tokens: { - /** Token metadata */ - metadata?: IMeemMetadataLike - - /** The address where the token will be minted to. */ - to: string - }[] - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } } export interface IDefinition { @@ -1175,34 +1166,36 @@ export namespace BulkMintAgreementRoleTokens { - -/** Bulk mint agreement tokens */ -export namespace BulkMintAgreementTokens { +export namespace JoinGuild { export interface IPathParams { - /** The id of the agreement */ + /** The Agreement id */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/bulkMint` + `/api/1.0/agreements/${options.agreementId}/joinGuild` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - tokens: { - /** The token metadata */ - metadata?: IMeemMetadataLike - - /** The address where the token will be minted */ - to: string - }[] + message: string + params: { + chainId?: string + msg: string + method: number + addr: string + nonce: string + hash?: string + ts: string + } + sig: string + mintToken?: boolean } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id. Only if the agreement is on-chain */ - txId?: string + status: 'success' } export interface IDefinition { @@ -1217,25 +1210,29 @@ export namespace BulkMintAgreementTokens { +export namespace CreateBundle { + export interface IPathParams {} -/** Checks if the current user is an Agreement admin either by holding the Admin token or having the admin role on the contract */ -export namespace CheckIsAgreementAdmin { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/isAdmin` + export const path = () => `/api/1.0/epm/bundles` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + name: string + description: string + // contractIds: string[] + contracts: { + id: string + functionSelectors: string[] + }[] + } export interface IResponseBody extends IApiResponseBody { - isAdmin: boolean + bundleId: string + types: string + abi: Record[] } export interface IDefinition { @@ -1250,99 +1247,86 @@ export namespace CheckIsAgreementAdmin { -/** Create an agreement contract. */ -export namespace CreateAgreement { +export namespace CreateContract { export interface IPathParams {} - export const path = () => `/api/1.0/agreements` + export const path = () => `/api/1.0/epm/contracts` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The name of the contract */ name: string + description: string + contractType: ContractType + abi: any[] + bytecode: string + } - /** Agreement contract metadata */ - metadata: IMeemMetadataLike - - /** If true, will deploy the contract on the chain. Default false */ - isOnChain?: boolean - - /** If true a contract will be deployed. Default false */ - shouldCreateContract?: boolean - - /** The contract chain id */ - chainId?: number - - /** The max number of tokens */ - maxSupply?: string - - /** Whether the max number of tokens is locked */ - isMaxSupplyLocked?: boolean - - /** The contract symbol. If omitted, will use slug generated from name. */ - symbol?: string + export interface IResponseBody extends IApiResponseBody { + status: 'success' + contractId: string + } - /** Contract admin addresses */ - admins?: string[] + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } - /** Special minter permissions */ - minters?: string[] + export type Response = IResponseBody | IError +} - /** Minting permissions */ - mintPermissions?: Omit[] - /** Splits for minting / transfers */ - splits?: IMeemSplit[] - /** Whether tokens can be transferred */ - isTransferLocked?: boolean +export namespace TrackContractInstance { + export interface IPathParams {} - /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ - shouldMintTokens?: boolean + export const path = () => `/api/1.0/epm/contractInstances` - /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ - members?: string[] + export const method = HttpMethod.Post - /** Token metadata to use if shouldMintTokens is true */ - tokenMetadata?: IMeemMetadataLike + export interface IQueryParams {} - /** If true, will create an admin role contract and set it as the admin contract for this agreement */ - shouldCreateAdminRole?: boolean + export interface IRequestBody { + address: string + chainId: number } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for deploying the contract. Transaction #1 */ - deployContractTxId?: string + status: 'success' + } - /** The Transaction id for initializing the contract. Transaction #2 */ - cutTxId?: string + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } - /** The Transaction id for minting tokens. Transaction #3 */ - mintTxId?: string + export type Response = IResponseBody | IError +} - /** The Transaction id for deploying the admin role contract. Transaction #4 */ - adminRoleDeployContractTxId?: string - /** The Transaction id for initializing the admin role contract. Transaction #5 */ - adminRoleCutTxId?: string - /** The Transaction id for setting the role contract as the admin contract on the agreement. Transaction #6 */ - adminRoleSetAdminContractTxId?: string +export namespace UntrackContractInstance { + export interface IPathParams { + contractInstanceId: string + } - /** The Transaction id for minting admin role tokens. Transaction #7 */ - adminRoleMintTxId?: string + export const path = (options: IPathParams) => + `/api/1.0/epm/contractInstances/${options.contractInstanceId}` - /** The agreement id. Available only if isOnChain=false */ - agreementId?: string + export const method = HttpMethod.Delete - /** The admin agreement id. Available only if isOnChain=false */ - adminAgreementId?: string + export interface IQueryParams {} - /** The slug for the agreement. Available only if isOnChain=false */ - slug?: string + export interface IRequestBody {} + + export interface IResponseBody extends IApiResponseBody { + status: 'success' } export interface IDefinition { @@ -1357,60 +1341,30 @@ export namespace CreateAgreement { - -/** Create an agreement extension */ -export namespace CreateAgreementExtension { +export namespace UpdateBundle { export interface IPathParams { - /** The id of the agreement */ - agreementId: string + bundleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/extensions` + `/api/1.0/epm/bundles/${options.bundleId}` - export const method = HttpMethod.Post + export const method = HttpMethod.Put export interface IQueryParams {} export interface IRequestBody { - /** The id of the extension to enable */ - extensionId: string - - /** Whether the extension initialization is complete */ - isInitialized?: boolean - - /** Whether the extension setup is complete */ - isSetupComplete?: boolean - - /** Optional metadata associated with this extension */ - metadata?: { - [key: string]: any - } - - /** Optional external link associated with this extension */ - externalLink?: { - /** Url for the link */ - url: string - /** The link label */ - label?: string - /** Visibility of the link extension */ - visibility?: AgreementExtensionVisibility - } - - /** Optional widget data associated with this extension */ - widget?: { - /** Metadata associated with the extension widget */ - metadata?: IMeemMetadataLike - /** Visibility of the widget extension */ - visibility?: AgreementExtensionVisibility - } + name: string + description: string + contracts: { + id: string + functionSelectors: string[] + }[] } export interface IResponseBody extends IApiResponseBody { - status: 'success' - - /** The Transaction ids that must be completed as part of creating the extension. May be empty if no transactions are required. */ - txIds: string[] + types: string + abi: Record[] } export interface IDefinition { @@ -1425,62 +1379,25 @@ export namespace CreateAgreementExtension { - -/** Create an agreement role contract */ -export namespace CreateAgreementRole { +export namespace UpdateWalletContractInstance { export interface IPathParams { - /** The id of the agreement */ - agreementId: string + contractInstanceId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles` + `/api/1.0/epm/walletContractInstances/${options.contractInstanceId}` - export const method = HttpMethod.Post + export const method = HttpMethod.Patch export interface IQueryParams {} export interface IRequestBody { - /** The name of the agreement role contract */ + note: string name: string - - /** Agreement role contract metadata */ - metadata: IMeemMetadataLike - - /** The max number of tokens */ - maxSupply: string - - /** Whether the max supply is locked */ - isMaxSupplyLocked?: boolean - - /** The contract symbol. If omitted, will use slug generated from name */ - symbol?: string - - /** Splits for minting / transfers */ - splits?: IMeemSplit[] - - /** Whether tokens can be transferred */ - isTransferLocked?: boolean - - /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ - shouldMintTokens?: boolean - - /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ - members?: string[] - - /** Token metadata to use if shouldMintTokens is true */ - tokenMetadata?: IMeemMetadataLike } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for deploying the contract. Transaction #1 */ - deployContractTxId: string - - /** The Transaction id for initializing the contract. Transaction #2 */ - cutTxId: string - - /** The Transaction id for minting tokens. Transaction #3 */ - mintTxId?: string + status: 'success' } export interface IDefinition { @@ -1495,34 +1412,29 @@ export namespace CreateAgreementRole { - -/** Create an agreement safe */ -export namespace CreateAgreementSafe { +/** Bulk mint agreement role tokens */ +export namespace BulkBurnAgreementRoleTokens { export interface IPathParams { + /** The id of the agreement */ agreementId: string + /** The id of the agreement role */ + agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/safe` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkBurn` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** Addresses of the safe owners */ - safeOwners: string[] - - /** Chain id of the safe */ - chainId?: number - - /** The number of signatures required */ - threshold?: number + tokenIds: string[] } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id */ - txId: string + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1538,26 +1450,27 @@ export namespace CreateAgreementSafe { -/** Delete an agreement role contract */ -export namespace DeleteAgreementRole { +/** Bulk mint agreement tokens */ +export namespace BulkBurnAgreementTokens { export interface IPathParams { /** The id of the agreement */ agreementId: string - /** The id of the agreement role */ - agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` + `/api/1.0/agreements/${options.agreementId}/bulkBurn` - export const method = HttpMethod.Delete + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + tokenIds: string[] + } export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1573,8 +1486,8 @@ export namespace DeleteAgreementRole { -/** Get an agreement role */ -export namespace GetAgreementRole { +/** Bulk mint agreement role tokens */ +export namespace BulkMintAgreementRoleTokens { export interface IPathParams { /** The id of the agreement */ agreementId: string @@ -1583,16 +1496,25 @@ export namespace GetAgreementRole { } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/bulkMint` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + tokens: { + /** Token metadata */ + metadata?: IMeemMetadataLike + + /** The address where the token will be minted to. */ + to: string + }[] + } export interface IResponseBody extends IApiResponseBody { - role: IAgreementRole + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1608,23 +1530,33 @@ export namespace GetAgreementRole { -export namespace GetAgreementRoles { +/** Bulk mint agreement tokens */ +export namespace BulkMintAgreementTokens { export interface IPathParams { - /** The Agreement id to fetch roles of */ + /** The id of the agreement */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles` + `/api/1.0/agreements/${options.agreementId}/bulkMint` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + tokens: { + /** The token metadata */ + metadata?: IMeemMetadataLike + + /** The address where the token will be minted */ + to: string + }[] + } export interface IResponseBody extends IApiResponseBody { - roles: any[] + /** The Transaction id. Only if the agreement is on-chain */ + txId?: string } export interface IDefinition { @@ -1640,15 +1572,15 @@ export namespace GetAgreementRoles { -/** Get agreement minting proof */ -export namespace GetMintingProof { +/** Checks if the current user is an Agreement admin either by holding the Admin token or having the admin role on the contract */ +export namespace CheckIsAgreementAdmin { export interface IPathParams { /** The id of the agreement */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/proof` + `/api/1.0/agreements/${options.agreementId}/isAdmin` export const method = HttpMethod.Get @@ -1657,7 +1589,7 @@ export namespace GetMintingProof { export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - proof: string[] + isAdmin: boolean } export interface IDefinition { @@ -1672,28 +1604,99 @@ export namespace GetMintingProof { - -/** Check if agreement slug is available */ -export namespace IsSlugAvailable { +/** Create an agreement contract. */ +export namespace CreateAgreement { export interface IPathParams {} - export const path = (options: IPathParams) => - `/api/1.0/agreements/isSlugAvailable` + export const path = () => `/api/1.0/agreements` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** New agreement slug to check */ - slug: string + /** The name of the contract */ + name: string - /** The chain id of new agreement */ - chainId: number + /** Agreement contract metadata */ + metadata: IMeemMetadataLike + + /** If true, will deploy the contract on the chain. Default false */ + isOnChain?: boolean + + /** If true a contract will be deployed. Default false */ + shouldCreateContract?: boolean + + /** The contract chain id */ + chainId?: number + + /** The max number of tokens */ + maxSupply?: string + + /** Whether the max number of tokens is locked */ + isMaxSupplyLocked?: boolean + + /** The contract symbol. If omitted, will use slug generated from name. */ + symbol?: string + + /** Contract admin addresses */ + admins?: string[] + + /** Special minter permissions */ + minters?: string[] + + /** Minting permissions */ + mintPermissions?: Omit[] + + /** Splits for minting / transfers */ + splits?: IMeemSplit[] + + /** Whether tokens can be transferred */ + isTransferLocked?: boolean + + /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ + shouldMintTokens?: boolean + + /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ + members?: string[] + + /** Token metadata to use if shouldMintTokens is true */ + tokenMetadata?: IMeemMetadataLike + + /** If true, will create an admin role contract and set it as the admin contract for this agreement */ + shouldCreateAdminRole?: boolean } export interface IResponseBody extends IApiResponseBody { - isSlugAvailable: boolean + /** The Transaction id for deploying the contract. Transaction #1 */ + deployContractTxId?: string + + /** The Transaction id for initializing the contract. Transaction #2 */ + cutTxId?: string + + /** The Transaction id for minting tokens. Transaction #3 */ + mintTxId?: string + + /** The Transaction id for deploying the admin role contract. Transaction #4 */ + adminRoleDeployContractTxId?: string + + /** The Transaction id for initializing the admin role contract. Transaction #5 */ + adminRoleCutTxId?: string + + /** The Transaction id for setting the role contract as the admin contract on the agreement. Transaction #6 */ + adminRoleSetAdminContractTxId?: string + + /** The Transaction id for minting admin role tokens. Transaction #7 */ + adminRoleMintTxId?: string + + /** The agreement id. Available only if isOnChain=false */ + agreementId?: string + + /** The admin agreement id. Available only if isOnChain=false */ + adminAgreementId?: string + + /** The slug for the agreement. Available only if isOnChain=false */ + slug?: string } export interface IDefinition { @@ -1709,52 +1712,59 @@ export namespace IsSlugAvailable { -/** Reinitialize an agreement contract */ -export namespace ReInitializeAgreement { +/** Create an agreement extension */ +export namespace CreateAgreementExtension { export interface IPathParams { /** The id of the agreement */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/reinitialize` + `/api/1.0/agreements/${options.agreementId}/extensions` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The name of the contract */ - name?: string - - /** The max number of tokens */ - maxSupply?: string - - /** Agreement contract metadata */ - metadata?: IMeemMetadataLike - - /** The contract symbol. If omitted, will use slug generated from name */ - symbol?: string + /** The id of the extension to enable */ + extensionId: string - /** Contract admin addresses */ - admins?: string[] + /** Whether the extension initialization is complete */ + isInitialized?: boolean - /** Special minter permissions */ - minters?: string[] + /** Whether the extension setup is complete */ + isSetupComplete?: boolean - /** Minting permissions */ - mintPermissions?: Omit[] + /** Optional metadata associated with this extension */ + metadata?: { + [key: string]: any + } - /** Splits for minting / transfers */ - splits?: IMeemSplit[] + /** Optional external link associated with this extension */ + externalLink?: { + /** Url for the link */ + url: string + /** The link label */ + label?: string + /** Visibility of the link extension */ + visibility?: AgreementExtensionVisibility + } - /** Whether tokens can be transferred */ - isTransferLocked?: boolean + /** Optional widget data associated with this extension */ + widget?: { + /** Metadata associated with the extension widget */ + metadata?: IMeemMetadataLike + /** Visibility of the widget extension */ + visibility?: AgreementExtensionVisibility + } } export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for updating the contract. Only available if agreement is on chain */ - txId?: string + status: 'success' + + /** The Transaction ids that must be completed as part of creating the extension. May be empty if no transactions are required. */ + txIds: string[] } export interface IDefinition { @@ -1770,31 +1780,32 @@ export namespace ReInitializeAgreement { -/** Reinitialize an agreement contract */ -export namespace ReInitializeAgreementRole { +/** Create an agreement role contract */ +export namespace CreateAgreementRole { export interface IPathParams { /** The id of the agreement */ agreementId: string - /** The id of the agreement role */ - agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/reinitialize` + `/api/1.0/agreements/${options.agreementId}/roles` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The name of the contract */ - name?: string + /** The name of the agreement role contract */ + name: string + + /** Agreement role contract metadata */ + metadata: IMeemMetadataLike /** The max number of tokens */ - maxSupply?: string + maxSupply: string - /** Agreement role contract metadata */ - metadata?: IMeemMetadataLike + /** Whether the max supply is locked */ + isMaxSupplyLocked?: boolean /** The contract symbol. If omitted, will use slug generated from name */ symbol?: string @@ -1804,48 +1815,26 @@ export namespace ReInitializeAgreementRole { /** Whether tokens can be transferred */ isTransferLocked?: boolean - } - - export interface IResponseBody extends IApiResponseBody { - /** The Transaction id for updating the contract. Only available if agreement is on chain */ - txId?: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - + /** If true, will mint a token to the admin wallet addresses and any addresses in the members parameter */ + shouldMintTokens?: boolean + /** Additional non-admin member addresses that will receive tokens if shouldMintTokens is true */ + members?: string[] -/** Set the agreement admin role */ -export namespace SetAgreementAdminRole { - export interface IPathParams { - /** The id of the agreement */ - agreementId: string + /** Token metadata to use if shouldMintTokens is true */ + tokenMetadata?: IMeemMetadataLike } - export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/setAdminRole` - - export const method = HttpMethod.Patch - - export interface IQueryParams {} + export interface IResponseBody extends IApiResponseBody { + /** The Transaction id for deploying the contract. Transaction #1 */ + deployContractTxId: string - export interface IRequestBody { - /** The id of the agreement role to set as admin role */ - adminAgreementRoleId: string - } + /** The Transaction id for initializing the contract. Transaction #2 */ + cutTxId: string - export interface IResponseBody extends IApiResponseBody { - /** The Transaction id */ - txId: string + /** The Transaction id for minting tokens. Transaction #3 */ + mintTxId?: string } export interface IDefinition { @@ -1854,13 +1843,15 @@ export namespace SetAgreementAdminRole { requestBody: IRequestBody responseBody: IResponseBody } + + export type Response = IResponseBody | IError } -/** Set the agreement safe address */ -export namespace SetAgreementSafeAddress { +/** Create an agreement safe */ +export namespace CreateAgreementSafe { export interface IPathParams { agreementId: string } @@ -1868,20 +1859,24 @@ export namespace SetAgreementSafeAddress { export const path = (options: IPathParams) => `/api/1.0/agreements/${options.agreementId}/safe` - export const method = HttpMethod.Patch + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The safe address */ - address: string + /** Addresses of the safe owners */ + safeOwners: string[] /** Chain id of the safe */ chainId?: number + + /** The number of signatures required */ + threshold?: number } export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The Transaction id */ + txId: string } export interface IDefinition { @@ -1897,24 +1892,23 @@ export namespace SetAgreementSafeAddress { -/** Update off-chain agreement data */ -export namespace UpdateAgreement { +/** Delete an agreement role contract */ +export namespace DeleteAgreementRole { export interface IPathParams { /** The id of the agreement */ agreementId: string + /** The id of the agreement role */ + agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` - export const method = HttpMethod.Patch + export const method = HttpMethod.Delete export interface IQueryParams {} - export interface IRequestBody { - /** Whether the agreement is launched and visible to members */ - isLaunched: boolean - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { status: 'success' @@ -1933,56 +1927,26 @@ export namespace UpdateAgreement { -/** Update an agreement extension */ -export namespace UpdateAgreementExtension { +/** Get an agreement role */ +export namespace GetAgreementRole { export interface IPathParams { /** The id of the agreement */ agreementId: string - - /** The agreement extension id */ - agreementExtensionId: string + /** The id of the agreement role */ + agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/extensions/${options.agreementExtensionId}` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}` - export const method = HttpMethod.Put + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - /** Whether the extension initialization is complete */ - isInitialized?: boolean - /** Whether the extension setup is complete */ - isSetupComplete?: boolean - /** Optional metadata associated with this extension */ - metadata?: { - [key: string]: any - } | null - /** Optional external link associated with this extension */ - externalLink?: { - /** Url for the link */ - url: string - /** The link label */ - label?: string - /** Whether link should be enabled */ - isEnabled?: boolean - /** Visibility of the extension link */ - visibility?: AgreementExtensionVisibility - } | null - /** Optional widget data associated with this extension */ - widget?: { - /** Metadata associated with the extension widget */ - metadata?: IMeemMetadataLike - /** Whether widget should be enabled */ - isEnabled?: boolean - /** Visibility of the extension widget */ - visibility?: AgreementExtensionVisibility - } | null - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - status: 'success' + role: IAgreementRole } export interface IDefinition { @@ -1998,27 +1962,23 @@ export namespace UpdateAgreementExtension { -/** Upgrade an agreement contract */ -export namespace UpgradeAgreement { +export namespace GetAgreementRoles { export interface IPathParams { + /** The Agreement id to fetch roles of */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/upgrade` + `/api/1.0/agreements/${options.agreementId}/roles` - export const method = HttpMethod.Post + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ - bundleId?: string - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - /** The Transaction id */ - txId: string + roles: any[] } export interface IDefinition { @@ -2034,30 +1994,24 @@ export namespace UpgradeAgreement { -/** Upgrade an agreement role contract */ -export namespace UpgradeAgreementRole { +/** Get agreement minting proof */ +export namespace GetMintingProof { export interface IPathParams { /** The id of the agreement */ agreementId: string - /** The id of the agreement role */ - agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/upgrade` + `/api/1.0/agreements/${options.agreementId}/proof` - export const method = HttpMethod.Post + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ - bundleId?: string - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - /** The Transaction id */ - txId: string + proof: string[] } export interface IDefinition { @@ -2073,59 +2027,27 @@ export namespace UpgradeAgreementRole { -export namespace AuthenticateWithDiscord { +/** Check if agreement slug is available */ +export namespace IsSlugAvailable { export interface IPathParams {} - export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` + export const path = (options: IPathParams) => + `/api/1.0/agreements/isSlugAvailable` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } - - export interface IResponseBody extends IApiResponseBody { - user: { [key: string]: any } - accessToken: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace GetDiscordServers { - export interface IPathParams {} - - export const path = (options: IPathParams) => `/api/1.0/discord/servers` - - export const method = HttpMethod.Get - - export interface IQueryParams { - accessToken: string - } - - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string + /** New agreement slug to check */ + slug: string + + /** The chain id of new agreement */ + chainId: number } export interface IResponseBody extends IApiResponseBody { - discordServers: IDiscordServer[] + isSlugAvailable: boolean } export interface IDefinition { @@ -2140,29 +2062,53 @@ export namespace GetDiscordServers { -export namespace CreateBundle { - export interface IPathParams {} - export const path = () => `/api/1.0/epm/bundles` +/** Reinitialize an agreement contract */ +export namespace ReInitializeAgreement { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/reinitialize` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - name: string - description: string - // contractIds: string[] - contracts: { - id: string - functionSelectors: string[] - }[] + /** The name of the contract */ + name?: string + + /** The max number of tokens */ + maxSupply?: string + + /** Agreement contract metadata */ + metadata?: IMeemMetadataLike + + /** The contract symbol. If omitted, will use slug generated from name */ + symbol?: string + + /** Contract admin addresses */ + admins?: string[] + + /** Special minter permissions */ + minters?: string[] + + /** Minting permissions */ + mintPermissions?: Omit[] + + /** Splits for minting / transfers */ + splits?: IMeemSplit[] + + /** Whether tokens can be transferred */ + isTransferLocked?: boolean } export interface IResponseBody extends IApiResponseBody { - bundleId: string - types: string - abi: Record[] + /** The Transaction id for updating the contract. Only available if agreement is on chain */ + txId?: string } export interface IDefinition { @@ -2177,26 +2123,46 @@ export namespace CreateBundle { -export namespace CreateContract { - export interface IPathParams {} - export const path = () => `/api/1.0/epm/contracts` +/** Reinitialize an agreement contract */ +export namespace ReInitializeAgreementRole { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + /** The id of the agreement role */ + agreementRoleId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/reinitialize` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - name: string - description: string - contractType: ContractType - abi: any[] - bytecode: string + /** The name of the contract */ + name?: string + + /** The max number of tokens */ + maxSupply?: string + + /** Agreement role contract metadata */ + metadata?: IMeemMetadataLike + + /** The contract symbol. If omitted, will use slug generated from name */ + symbol?: string + + /** Splits for minting / transfers */ + splits?: IMeemSplit[] + + /** Whether tokens can be transferred */ + isTransferLocked?: boolean } export interface IResponseBody extends IApiResponseBody { - status: 'success' - contractId: string + /** The Transaction id for updating the contract. Only available if agreement is on chain */ + txId?: string } export interface IDefinition { @@ -2211,22 +2177,29 @@ export namespace CreateContract { -export namespace TrackContractInstance { - export interface IPathParams {} - export const path = () => `/api/1.0/epm/contractInstances` +/** Set the agreement admin role */ +export namespace SetAgreementAdminRole { + export interface IPathParams { + /** The id of the agreement */ + agreementId: string + } - export const method = HttpMethod.Post + export const path = (options: IPathParams) => + `/api/1.0/agreements/${options.agreementId}/setAdminRole` + + export const method = HttpMethod.Patch export interface IQueryParams {} export interface IRequestBody { - address: string - chainId: number + /** The id of the agreement role to set as admin role */ + adminAgreementRoleId: string } export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The Transaction id */ + txId: string } export interface IDefinition { @@ -2235,25 +2208,31 @@ export namespace TrackContractInstance { requestBody: IRequestBody responseBody: IResponseBody } - - export type Response = IResponseBody | IError } -export namespace UntrackContractInstance { + +/** Set the agreement safe address */ +export namespace SetAgreementSafeAddress { export interface IPathParams { - contractInstanceId: string + agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/epm/contractInstances/${options.contractInstanceId}` + `/api/1.0/agreements/${options.agreementId}/safe` - export const method = HttpMethod.Delete + export const method = HttpMethod.Patch export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** The safe address */ + address: string + + /** Chain id of the safe */ + chainId?: number + } export interface IResponseBody extends IApiResponseBody { status: 'success' @@ -2271,30 +2250,28 @@ export namespace UntrackContractInstance { -export namespace UpdateBundle { + +/** Update off-chain agreement data */ +export namespace UpdateAgreement { export interface IPathParams { - bundleId: string + /** The id of the agreement */ + agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/epm/bundles/${options.bundleId}` + `/api/1.0/agreements/${options.agreementId}` - export const method = HttpMethod.Put + export const method = HttpMethod.Patch export interface IQueryParams {} export interface IRequestBody { - name: string - description: string - contracts: { - id: string - functionSelectors: string[] - }[] + /** Whether the agreement is launched and visible to members */ + isLaunched: boolean } export interface IResponseBody extends IApiResponseBody { - types: string - abi: Record[] + status: 'success' } export interface IDefinition { @@ -2309,21 +2286,53 @@ export namespace UpdateBundle { -export namespace UpdateWalletContractInstance { + +/** Update an agreement extension */ +export namespace UpdateAgreementExtension { export interface IPathParams { - contractInstanceId: string + /** The id of the agreement */ + agreementId: string + + /** The agreement extension id */ + agreementExtensionId: string } export const path = (options: IPathParams) => - `/api/1.0/epm/walletContractInstances/${options.contractInstanceId}` + `/api/1.0/agreements/${options.agreementId}/extensions/${options.agreementExtensionId}` - export const method = HttpMethod.Patch + export const method = HttpMethod.Put export interface IQueryParams {} export interface IRequestBody { - note: string - name: string + /** Whether the extension initialization is complete */ + isInitialized?: boolean + /** Whether the extension setup is complete */ + isSetupComplete?: boolean + /** Optional metadata associated with this extension */ + metadata?: { + [key: string]: any + } | null + /** Optional external link associated with this extension */ + externalLink?: { + /** Url for the link */ + url: string + /** The link label */ + label?: string + /** Whether link should be enabled */ + isEnabled?: boolean + /** Visibility of the extension link */ + visibility?: AgreementExtensionVisibility + } | null + /** Optional widget data associated with this extension */ + widget?: { + /** Metadata associated with the extension widget */ + metadata?: IMeemMetadataLike + /** Whether widget should be enabled */ + isEnabled?: boolean + /** Visibility of the extension widget */ + visibility?: AgreementExtensionVisibility + } | null } export interface IResponseBody extends IApiResponseBody { @@ -2342,32 +2351,28 @@ export namespace UpdateWalletContractInstance { -export namespace GetJoinGuildMessage { + +/** Upgrade an agreement contract */ +export namespace UpgradeAgreement { export interface IPathParams { - /** The Agreement id */ agreementId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/getJoinGuildMessage` + `/api/1.0/agreements/${options.agreementId}/upgrade` - export const method = HttpMethod.Get + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ + bundleId?: string + } export interface IResponseBody extends IApiResponseBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } + /** The Transaction id */ + txId: string } export interface IDefinition { @@ -2382,36 +2387,31 @@ export namespace GetJoinGuildMessage { -export namespace JoinGuild { + +/** Upgrade an agreement role contract */ +export namespace UpgradeAgreementRole { export interface IPathParams { - /** The Agreement id */ + /** The id of the agreement */ agreementId: string + /** The id of the agreement role */ + agreementRoleId: string } export const path = (options: IPathParams) => - `/api/1.0/agreements/${options.agreementId}/joinGuild` + `/api/1.0/agreements/${options.agreementId}/roles/${options.agreementRoleId}/upgrade` export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - message: string - params: { - chainId?: string - msg: string - method: number - addr: string - nonce: string - hash?: string - ts: string - } - sig: string - mintToken?: boolean + /** Specify the bundle id to upgrade to. Defaults to latest Agreements bundle */ + bundleId?: string } export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The Transaction id */ + txId: string } export interface IDefinition { @@ -2426,6 +2426,7 @@ export namespace JoinGuild { + /** Create or update the current user */ export namespace CreateOrUpdateUser { export interface IPathParams {} diff --git a/src/types/meem.public.generated.ts b/src/types/meem.public.generated.ts index 2fbb4386..42ec0ff0 100644 --- a/src/types/meem.public.generated.ts +++ b/src/types/meem.public.generated.ts @@ -893,6 +893,7 @@ export interface IWebhookBody { totalVetoers: number reactions: IWebhookReaction[] createdTimestamp?: number + inputMetadata?: any } export namespace v1 { @@ -1056,6 +1057,73 @@ export namespace Login { +export namespace AuthenticateWithDiscord { + export interface IPathParams {} + + export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` + + export const method = HttpMethod.Post + + export interface IQueryParams {} + + export interface IRequestBody { + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string + } + + export interface IResponseBody extends IApiResponseBody { + user: { [key: string]: any } + accessToken: string + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + +export namespace GetDiscordServers { + export interface IPathParams {} + + export const path = (options: IPathParams) => `/api/1.0/discord/servers` + + export const method = HttpMethod.Get + + export interface IQueryParams { + accessToken: string + } + + export interface IRequestBody { + /** The Discord authentication code */ + authCode: string + /** The Discord authentication callback url */ + redirectUri: string + } + + export interface IResponseBody extends IApiResponseBody { + discordServers: IDiscordServer[] + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + + + /** Bulk mint agreement role tokens */ export namespace BulkBurnAgreementRoleTokens { export interface IPathParams { @@ -2071,111 +2139,6 @@ export namespace UpgradeAgreementRole { -export namespace AuthenticateWithDiscord { - export interface IPathParams {} - - export const path = (options: IPathParams) => `/api/1.0/discord/authenticate` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } - - export interface IResponseBody extends IApiResponseBody { - user: { [key: string]: any } - accessToken: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -export namespace GetDiscordServers { - export interface IPathParams {} - - export const path = (options: IPathParams) => `/api/1.0/discord/servers` - - export const method = HttpMethod.Get - - export interface IQueryParams { - accessToken: string - } - - export interface IRequestBody { - /** The Discord authentication code */ - authCode: string - /** The Discord authentication callback url */ - redirectUri: string - } - - export interface IResponseBody extends IApiResponseBody { - discordServers: IDiscordServer[] - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - - - -/** Save some data to IPFS */ -export namespace SaveToIPFS { - export interface IPathParams {} - - export const path = () => `/api/1.0/ipfs` - - export const method = HttpMethod.Post - - export interface IQueryParams {} - - export interface IRequestBody { - /** The data to save. Only one of "data" or "json" should be sent */ - data?: string - - /** The JSON to save. Only one of "data" or "json" should be sent */ - json?: Record - } - - export interface IResponseBody extends IApiResponseBody { - /** The IPFS hash for the saved data */ - ipfsHash: string - } - - export interface IDefinition { - pathParams: IPathParams - queryParams: IQueryParams - requestBody: IRequestBody - responseBody: IResponseBody - } - - export type Response = IResponseBody | IError -} - -// TODO: How to specify json in OpenAPI definition - - - - export namespace CreateBundle { export interface IPathParams {} @@ -2462,25 +2425,28 @@ export namespace JoinGuild { -/** Redirect the user to this endpoint to authenticate w/ slack */ -export namespace AuthenticateWithSlack { +/** Create or update the current user */ +export namespace CreateOrUpdateUser { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/slack/auth' + export const path = () => `/api/1.0/me` - export const method = HttpMethod.Get + export const method = HttpMethod.Post - export interface IQueryParams { - /** The agreement id to associate the twitter account with */ - agreementId: string + export interface IQueryParams {} - /** The url to return the user to after authentication */ - returnUrl: string + export interface IRequestBody { + /** Profile picture base64 string */ + profilePicBase64?: string + /** Url to profile picture */ + // profilePicUrl?: string + /** Display name of identity */ + displayName?: string } - export interface IRequestBody {} - - export interface IResponseBody extends IApiResponseBody {} + export interface IResponseBody extends IApiResponseBody { + user: IMeemUser + } export interface IDefinition { pathParams: IPathParams @@ -2494,24 +2460,21 @@ export namespace AuthenticateWithSlack { -export namespace AuthenticateWithTwitter { + +export namespace GetApiKey { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/twitter/auth' + export const path = () => `/api/1.0/me/apiKey` export const method = HttpMethod.Get - export interface IQueryParams { - /** The agreement id to associate the twitter account with */ - agreementId: string - - /** The url to return the user to after authentication */ - returnUrl: string - } + export interface IQueryParams {} export interface IRequestBody {} - export interface IResponseBody extends IApiResponseBody {} + export interface IResponseBody extends IApiResponseBody { + jwt: string + } export interface IDefinition { pathParams: IPathParams @@ -2525,22 +2488,27 @@ export namespace AuthenticateWithTwitter { -export namespace DisconnectDiscord { +/** Get the current authenticated user */ +export namespace GetMe { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/discord' + export const path = () => `/api/1.0/me` - export const method = HttpMethod.Delete + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - /** The agreement discord to disconnect */ - agreementDiscordId: string - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The authenticated user's wallet id */ + walletId: string + + /** The authenticated user's wallet address */ + address: string + + /** The authenticated user */ + user: IMeemUser } export interface IDefinition { @@ -2555,19 +2523,18 @@ export namespace DisconnectDiscord { -export namespace DisconnectSlack { + +/** Refresh the ENS name for the current user's wallet address */ +export namespace RefreshENS { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/slack' + export const path = () => `/api/1.0/me/refreshENS` - export const method = HttpMethod.Delete + export const method = HttpMethod.Get export interface IQueryParams {} - export interface IRequestBody { - /** The agreement slack to disconnect */ - agreementSlackId: string - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { status: 'success' @@ -2585,19 +2552,22 @@ export namespace DisconnectSlack { -export namespace DisconnectTwitter { - export interface IPathParams {} - - export const path = () => '/api/1.0/symphony/twitter' - - export const method = HttpMethod.Delete + +/** Remove a user identity from the current user */ +export namespace RemoveUserIdentity { + export interface IPathParams { + /** The id of the user identity to remove */ + userIdentityId: string + } + + export const path = (options: IPathParams) => + `/api/1.0/me/identity/${options.userIdentityId}` + + export const method = HttpMethod.Delete export interface IQueryParams {} - export interface IRequestBody { - /** The agreement twitter to disconnect */ - agreementTwitterId: string - } + export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { status: 'success' @@ -2615,21 +2585,30 @@ export namespace DisconnectTwitter { -export namespace GetDiscordChannels { - export interface IPathParams {} - export const path = () => '/api/1.0/symphony/discord/channels' +/** Update current user identity */ +export namespace UpdateUserIdentity { + export interface IPathParams { + /** The id of the user identity to update */ + userIdentityId: string + } - export const method = HttpMethod.Get + export const path = (options: IPathParams) => + `/api/1.0/me/identity/${options.userIdentityId}` - export interface IQueryParams { - agreementDiscordId: string - } + export const method = HttpMethod.Patch - export interface IRequestBody {} + export interface IQueryParams {} + + export interface IRequestBody { + /** Set the visibility type of the user identity */ + visibility?: IUserIdentityVisibility + /** Metadata associated with this user identity */ + metadata?: { [key: string]: unknown } + } export interface IResponseBody extends IApiResponseBody { - channels: IDiscordChannel[] + userIdentity: any } export interface IDefinition { @@ -2644,26 +2623,28 @@ export namespace GetDiscordChannels { -export namespace GetDiscordEmojis { + +/** Save some data to IPFS */ +export namespace SaveToIPFS { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/discord/emojis' + export const path = () => `/api/1.0/ipfs` - export const method = HttpMethod.Get + export const method = HttpMethod.Post - export interface IQueryParams { - agreementDiscordId: string - } + export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** The data to save. Only one of "data" or "json" should be sent */ + data?: string + + /** The JSON to save. Only one of "data" or "json" should be sent */ + json?: Record + } export interface IResponseBody extends IApiResponseBody { - emojis: { - id: string - name: string - url?: string - isAnimated?: boolean | null - }[] + /** The IPFS hash for the saved data */ + ipfsHash: string } export interface IDefinition { @@ -2676,24 +2657,30 @@ export namespace GetDiscordEmojis { export type Response = IResponseBody | IError } +// TODO: How to specify json in OpenAPI definition + -export namespace GetDiscordRoles { + +/** Redirect the user to this endpoint to authenticate w/ slack */ +export namespace AuthenticateWithSlack { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/discord/roles' + export const path = () => '/api/1.0/symphony/slack/auth' export const method = HttpMethod.Get export interface IQueryParams { - agreementDiscordId: string + /** The agreement id to associate the twitter account with */ + agreementId: string + + /** The url to return the user to after authentication */ + returnUrl: string } export interface IRequestBody {} - export interface IResponseBody extends IApiResponseBody { - roles: IDiscordRole[] - } + export interface IResponseBody extends IApiResponseBody {} export interface IDefinition { pathParams: IPathParams @@ -2707,22 +2694,24 @@ export namespace GetDiscordRoles { -export namespace GetSlackChannels { +export namespace AuthenticateWithTwitter { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/slack/channels' + export const path = () => '/api/1.0/symphony/twitter/auth' export const method = HttpMethod.Get export interface IQueryParams { - agreementSlackId: string + /** The agreement id to associate the twitter account with */ + agreementId: string + + /** The url to return the user to after authentication */ + returnUrl: string } export interface IRequestBody {} - export interface IResponseBody extends IApiResponseBody { - channels: ISlackChannel[] - } + export interface IResponseBody extends IApiResponseBody {} export interface IDefinition { pathParams: IPathParams @@ -2736,26 +2725,22 @@ export namespace GetSlackChannels { -export namespace GetSlackEmojis { +export namespace DisconnectDiscord { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/slack/emojis' + export const path = () => '/api/1.0/symphony/discord' - export const method = HttpMethod.Get + export const method = HttpMethod.Delete - export interface IQueryParams { - agreementSlackId: string - } + export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** The agreement discord to disconnect */ + agreementDiscordId: string + } export interface IResponseBody extends IApiResponseBody { - emojis: { - id: string - name: string - url?: string - isAnimated?: boolean | null - }[] + status: 'success' } export interface IDefinition { @@ -2770,25 +2755,22 @@ export namespace GetSlackEmojis { -export namespace InviteDiscordBot { +export namespace DisconnectSlack { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/discord/inviteBot' + export const path = () => '/api/1.0/symphony/slack' - export const method = HttpMethod.Get + export const method = HttpMethod.Delete - export interface IQueryParams { - agreementId: string - } + export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + /** The agreement slack to disconnect */ + agreementSlackId: string + } export interface IResponseBody extends IApiResponseBody { - /** The url to invite the bot to your discord */ - inviteUrl: string - - /** The code to activate the bot using /activateSteward command */ - code: string + status: 'success' } export interface IDefinition { @@ -2803,18 +2785,18 @@ export namespace InviteDiscordBot { -export namespace RemoveRules { +export namespace DisconnectTwitter { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/removeRules' + export const path = () => '/api/1.0/symphony/twitter' - export const method = HttpMethod.Post + export const method = HttpMethod.Delete export interface IQueryParams {} export interface IRequestBody { - agreementId: string - ruleIds: string[] + /** The agreement twitter to disconnect */ + agreementTwitterId: string } export interface IResponseBody extends IApiResponseBody { @@ -2833,22 +2815,21 @@ export namespace RemoveRules { -export namespace SaveRule { +export namespace GetDiscordChannels { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/saveRule' - - export const method = HttpMethod.Post + export const path = () => '/api/1.0/symphony/discord/channels' - export interface IQueryParams {} + export const method = HttpMethod.Get - export interface IRequestBody { - agreementId: string - rule: IRuleToSave + export interface IQueryParams { + agreementDiscordId: string } + export interface IRequestBody {} + export interface IResponseBody extends IApiResponseBody { - status: 'success' + channels: IDiscordChannel[] } export interface IDefinition { @@ -2863,22 +2844,26 @@ export namespace SaveRule { -export namespace SlackAuthCallback { +export namespace GetDiscordEmojis { export interface IPathParams {} - export const path = () => '/api/1.0/symphony/slack/callback' + export const path = () => '/api/1.0/symphony/discord/emojis' export const method = HttpMethod.Get export interface IQueryParams { - /** The code to exchange for an access token */ - code: string + agreementDiscordId: string } export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - status: 'success' + emojis: { + id: string + name: string + url?: string + isAnimated?: boolean | null + }[] } export interface IDefinition { @@ -2893,27 +2878,21 @@ export namespace SlackAuthCallback { -/** Create or update the current user */ -export namespace CreateOrUpdateUser { +export namespace GetDiscordRoles { export interface IPathParams {} - export const path = () => `/api/1.0/me` - - export const method = HttpMethod.Post + export const path = () => '/api/1.0/symphony/discord/roles' - export interface IQueryParams {} + export const method = HttpMethod.Get - export interface IRequestBody { - /** Profile picture base64 string */ - profilePicBase64?: string - /** Url to profile picture */ - // profilePicUrl?: string - /** Display name of identity */ - displayName?: string + export interface IQueryParams { + agreementDiscordId: string } + export interface IRequestBody {} + export interface IResponseBody extends IApiResponseBody { - user: IMeemUser + roles: IDiscordRole[] } export interface IDefinition { @@ -2928,20 +2907,21 @@ export namespace CreateOrUpdateUser { - -export namespace GetApiKey { +export namespace GetSlackChannels { export interface IPathParams {} - export const path = () => `/api/1.0/me/apiKey` + export const path = () => '/api/1.0/symphony/slack/channels' export const method = HttpMethod.Get - export interface IQueryParams {} + export interface IQueryParams { + agreementSlackId: string + } export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - jwt: string + channels: ISlackChannel[] } export interface IDefinition { @@ -2956,27 +2936,26 @@ export namespace GetApiKey { -/** Get the current authenticated user */ -export namespace GetMe { +export namespace GetSlackEmojis { export interface IPathParams {} - export const path = () => `/api/1.0/me` + export const path = () => '/api/1.0/symphony/slack/emojis' export const method = HttpMethod.Get - export interface IQueryParams {} + export interface IQueryParams { + agreementSlackId: string + } export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - /** The authenticated user's wallet id */ - walletId: string - - /** The authenticated user's wallet address */ - address: string - - /** The authenticated user */ - user: IMeemUser + emojis: { + id: string + name: string + url?: string + isAnimated?: boolean | null + }[] } export interface IDefinition { @@ -2991,21 +2970,25 @@ export namespace GetMe { - -/** Refresh the ENS name for the current user's wallet address */ -export namespace RefreshENS { +export namespace InviteDiscordBot { export interface IPathParams {} - export const path = () => `/api/1.0/me/refreshENS` + export const path = () => '/api/1.0/symphony/discord/inviteBot' export const method = HttpMethod.Get - export interface IQueryParams {} + export interface IQueryParams { + agreementId: string + } export interface IRequestBody {} export interface IResponseBody extends IApiResponseBody { - status: 'success' + /** The url to invite the bot to your discord */ + inviteUrl: string + + /** The code to activate the bot using /activateSteward command */ + code: string } export interface IDefinition { @@ -3020,22 +3003,19 @@ export namespace RefreshENS { +export namespace RemoveRules { + export interface IPathParams {} -/** Remove a user identity from the current user */ -export namespace RemoveUserIdentity { - export interface IPathParams { - /** The id of the user identity to remove */ - userIdentityId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/me/identity/${options.userIdentityId}` + export const path = () => '/api/1.0/symphony/removeRules' - export const method = HttpMethod.Delete + export const method = HttpMethod.Post export interface IQueryParams {} - export interface IRequestBody {} + export interface IRequestBody { + agreementId: string + ruleIds: string[] + } export interface IResponseBody extends IApiResponseBody { status: 'success' @@ -3053,30 +3033,22 @@ export namespace RemoveUserIdentity { +export namespace SaveRule { + export interface IPathParams {} -/** Update current user identity */ -export namespace UpdateUserIdentity { - export interface IPathParams { - /** The id of the user identity to update */ - userIdentityId: string - } - - export const path = (options: IPathParams) => - `/api/1.0/me/identity/${options.userIdentityId}` + export const path = () => '/api/1.0/symphony/saveRule' - export const method = HttpMethod.Patch + export const method = HttpMethod.Post export interface IQueryParams {} export interface IRequestBody { - /** Set the visibility type of the user identity */ - visibility?: IUserIdentityVisibility - /** Metadata associated with this user identity */ - metadata?: { [key: string]: unknown } + agreementId: string + rule: IRuleToSave } export interface IResponseBody extends IApiResponseBody { - userIdentity: any + status: 'success' } export interface IDefinition { @@ -3090,6 +3062,35 @@ export namespace UpdateUserIdentity { } + +export namespace SlackAuthCallback { + export interface IPathParams {} + + export const path = () => '/api/1.0/symphony/slack/callback' + + export const method = HttpMethod.Get + + export interface IQueryParams { + /** The code to exchange for an access token */ + code: string + } + + export interface IRequestBody {} + + export interface IResponseBody extends IApiResponseBody { + status: 'success' + } + + export interface IDefinition { + pathParams: IPathParams + queryParams: IQueryParams + requestBody: IRequestBody + responseBody: IResponseBody + } + + export type Response = IResponseBody | IError +} + } export enum MeemEvent {