Skip to content

Commit 4dac489

Browse files
committed
Feat: create action when creating streaming payment
1 parent 93213e6 commit 4dac489

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

src/graphql/generated.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ export enum ColonyActionType {
400400
CreateDomainMotion = 'CREATE_DOMAIN_MOTION',
401401
/** An action related to creating an expenditure (advanced payment) */
402402
CreateExpenditure = 'CREATE_EXPENDITURE',
403+
/** An action related to creating a streaming payment */
404+
CreateStreamingPayment = 'CREATE_STREAMING_PAYMENT',
403405
/** An action related to editing a domain's details */
404406
EditDomain = 'EDIT_DOMAIN',
405407
/** An action related to editing a domain's details via a motion */
@@ -449,6 +451,8 @@ export enum ColonyActionType {
449451
PaymentMotion = 'PAYMENT_MOTION',
450452
/** An action related to the recovery functionality of a Colony */
451453
Recovery = 'RECOVERY',
454+
/** An action related to a motion to release a staged payment */
455+
ReleaseStagedPaymentMotion = 'RELEASE_STAGED_PAYMENT_MOTION',
452456
/** An action related to removing verified members */
453457
RemoveVerifiedMembers = 'REMOVE_VERIFIED_MEMBERS',
454458
RemoveVerifiedMembersMotion = 'REMOVE_VERIFIED_MEMBERS_MOTION',
@@ -1403,6 +1407,7 @@ export type CreateExpenditureInput = {
14031407
};
14041408

14051409
export type CreateExpenditureMetadataInput = {
1410+
distributionType?: InputMaybe<SplitPaymentDistributionType>;
14061411
fundFromDomainNativeId: Scalars['Int'];
14071412
id?: InputMaybe<Scalars['ID']>;
14081413
stages?: InputMaybe<Array<ExpenditureStageInput>>;
@@ -1973,6 +1978,11 @@ export type ExpenditureFundingItemInput = {
19731978
export type ExpenditureMetadata = {
19741979
__typename?: 'ExpenditureMetadata';
19751980
createdAt: Scalars['AWSDateTime'];
1981+
/**
1982+
* Specifies the distribution type selected when creating a split payment
1983+
* Will be null for other payment types
1984+
*/
1985+
distributionType?: Maybe<SplitPaymentDistributionType>;
19761986
fundFromDomainNativeId: Scalars['Int'];
19771987
id: Scalars['ID'];
19781988
stages?: Maybe<Array<ExpenditureStage>>;
@@ -3040,6 +3050,7 @@ export type ModelExpenditureFilterInput = {
30403050

30413051
export type ModelExpenditureMetadataConditionInput = {
30423052
and?: InputMaybe<Array<InputMaybe<ModelExpenditureMetadataConditionInput>>>;
3053+
distributionType?: InputMaybe<ModelSplitPaymentDistributionTypeInput>;
30433054
fundFromDomainNativeId?: InputMaybe<ModelIntInput>;
30443055
not?: InputMaybe<ModelExpenditureMetadataConditionInput>;
30453056
or?: InputMaybe<Array<InputMaybe<ModelExpenditureMetadataConditionInput>>>;
@@ -3053,6 +3064,7 @@ export type ModelExpenditureMetadataConnection = {
30533064

30543065
export type ModelExpenditureMetadataFilterInput = {
30553066
and?: InputMaybe<Array<InputMaybe<ModelExpenditureMetadataFilterInput>>>;
3067+
distributionType?: InputMaybe<ModelSplitPaymentDistributionTypeInput>;
30563068
fundFromDomainNativeId?: InputMaybe<ModelIntInput>;
30573069
id?: InputMaybe<ModelIdInput>;
30583070
not?: InputMaybe<ModelExpenditureMetadataFilterInput>;
@@ -3390,6 +3402,11 @@ export enum ModelSortDirection {
33903402
Desc = 'DESC',
33913403
}
33923404

3405+
export type ModelSplitPaymentDistributionTypeInput = {
3406+
eq?: InputMaybe<SplitPaymentDistributionType>;
3407+
ne?: InputMaybe<SplitPaymentDistributionType>;
3408+
};
3409+
33933410
export type ModelStreamingPaymentConditionInput = {
33943411
and?: InputMaybe<Array<InputMaybe<ModelStreamingPaymentConditionInput>>>;
33953412
createdAt?: InputMaybe<ModelStringInput>;
@@ -3831,6 +3848,7 @@ export type ModelSubscriptionExpenditureMetadataFilterInput = {
38313848
and?: InputMaybe<
38323849
Array<InputMaybe<ModelSubscriptionExpenditureMetadataFilterInput>>
38333850
>;
3851+
distributionType?: InputMaybe<ModelSubscriptionStringInput>;
38343852
fundFromDomainNativeId?: InputMaybe<ModelSubscriptionIntInput>;
38353853
id?: InputMaybe<ModelSubscriptionIdInput>;
38363854
or?: InputMaybe<
@@ -6823,6 +6841,12 @@ export enum SortingMethod {
68236841
ByMorePermissions = 'BY_MORE_PERMISSIONS',
68246842
}
68256843

6844+
export enum SplitPaymentDistributionType {
6845+
Equal = 'EQUAL',
6846+
Reputation = 'REPUTATION',
6847+
Unequal = 'UNEQUAL',
6848+
}
6849+
68266850
export type StakedExpenditureParams = {
68276851
__typename?: 'StakedExpenditureParams';
68286852
stakeFraction: Scalars['String'];
@@ -7970,6 +7994,7 @@ export type UpdateExpenditureInput = {
79707994
};
79717995

79727996
export type UpdateExpenditureMetadataInput = {
7997+
distributionType?: InputMaybe<SplitPaymentDistributionType>;
79737998
fundFromDomainNativeId?: InputMaybe<Scalars['Int']>;
79747999
id: Scalars['ID'];
79758000
stages?: InputMaybe<Array<ExpenditureStageInput>>;

src/handlers/expenditures/streamingPaymentCreated.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
import { mutate } from '~amplifyClient';
22
import {
3+
ColonyActionType,
34
CreateStreamingPaymentDocument,
45
CreateStreamingPaymentMutation,
56
CreateStreamingPaymentMutationVariables,
67
} from '~graphql';
78
import { ContractEvent } from '~types';
89
import {
10+
getDomainDatabaseId,
911
getExpenditureDatabaseId,
1012
getStreamingPaymentsClient,
1113
toNumber,
1214
verbose,
15+
writeActionFromEvent,
1316
} from '~utils';
1417

1518
export default async (event: ContractEvent): Promise<void> => {
1619
const { colonyAddress, blockNumber } = event;
17-
const { streamingPaymentId } = event.args;
20+
const { streamingPaymentId, agent: initiatorAddress } = event.args;
1821
const convertedNativeId = toNumber(streamingPaymentId);
1922

2023
if (!colonyAddress) {
@@ -62,4 +65,11 @@ export default async (event: ContractEvent): Promise<void> => {
6265
interval: interval.toString(),
6366
},
6467
});
68+
69+
await writeActionFromEvent(event, colonyAddress, {
70+
type: ColonyActionType.CreateStreamingPayment,
71+
initiatorAddress,
72+
expenditureId: databaseId,
73+
fromDomainId: getDomainDatabaseId(colonyAddress, toNumber(domainId)),
74+
});
6575
};

0 commit comments

Comments
 (0)