diff --git a/src/entities/projectAddress.ts b/src/entities/projectAddress.ts index a98e5d560..a57f5e36c 100644 --- a/src/entities/projectAddress.ts +++ b/src/entities/projectAddress.ts @@ -32,7 +32,7 @@ export class ProjectAddress extends BaseEntity { @Column() networkId: number; - @Field() + @Field(type => String) @Column({ type: 'enum', enum: ChainType, diff --git a/src/resolvers/projectResolver.test.ts b/src/resolvers/projectResolver.test.ts index 51b34dec9..810681eb5 100644 --- a/src/resolvers/projectResolver.test.ts +++ b/src/resolvers/projectResolver.test.ts @@ -3812,7 +3812,7 @@ function addRecipientAddressToProjectTestCases() { SEED_DATA.DAI_SMART_CONTRACT_ADDRESS, ); }); - it('Should add address successfully', async () => { + it('Should add address successfully - EVM', async () => { const user = await saveUserDirectlyToDb(generateRandomEtheriumAddress()); const accessToken = await generateTestAccessToken(user.id); const project = await saveProjectDirectlyToDb({ @@ -3841,7 +3841,46 @@ function addRecipientAddressToProjectTestCases() { assert.isOk(response.data.data.addRecipientAddressToProject); assert.isOk( response.data.data.addRecipientAddressToProject.addresses.find( - projectAddress => projectAddress.address === newWalletAddress, + projectAddress => + projectAddress.address === newWalletAddress && + projectAddress.chainType === ChainType.EVM, + ), + ); + }); + + it('Should add address successfully - EVM', async () => { + const user = await saveUserDirectlyToDb(generateRandomEtheriumAddress()); + const accessToken = await generateTestAccessToken(user.id); + const project = await saveProjectDirectlyToDb({ + ...createProjectData(), + admin: String(user.id), + }); + const newWalletAddress = generateRandomSolanaAddress(); + + const response = await axios.post( + graphqlUrl, + { + query: addRecipientAddressToProjectQuery, + variables: { + projectId: project.id, + networkId: 0, + address: newWalletAddress, + chainType: ChainType.SOLANA, + }, + }, + { + headers: { + Authorization: `Bearer ${accessToken}`, + }, + }, + ); + // assert.equal(JSON.stringify(response.data, null, 4), 'hi'); + assert.isOk(response.data.data.addRecipientAddressToProject); + assert.isOk( + response.data.data.addRecipientAddressToProject.addresses.find( + projectAddress => + projectAddress.address === newWalletAddress && + projectAddress.chainType === ChainType.SOLANA, ), ); }); @@ -3940,6 +3979,7 @@ function addRecipientAddressToProjectTestCases() { projectId: project.id, networkId: NETWORK_IDS.POLYGON, address: newWalletAddress, + chainType: ChainType.EVM, }, }, { diff --git a/test/graphqlQueries.ts b/test/graphqlQueries.ts index 962ea0b19..9767d769c 100644 --- a/test/graphqlQueries.ts +++ b/test/graphqlQueries.ts @@ -127,8 +127,8 @@ export const updateProjectQuery = ` `; export const addRecipientAddressToProjectQuery = ` - mutation ($projectId: Float!, $networkId: Float!, $address: String!) { - addRecipientAddressToProject(projectId: $projectId, networkId: $networkId, address: $address) { + mutation ($projectId: Float!, $networkId: Float!, $address: String!, $chainType: ChainType) { + addRecipientAddressToProject(projectId: $projectId, networkId: $networkId, address: $address, chainType: $chainType) { id title description @@ -1365,7 +1365,7 @@ export const projectByIdQuery = ` address isRecipient networkId - chaintype + chainType } organization { name