Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 72 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,75 @@ jobs:
- uses: volta-cli/action@v4

- run: yarn install --frozen-lockfile
- run: npm publish

- name: Publish to npm
id: publish
run: npm publish

# Extract package info before cloning small-things (to avoid workspace conflicts)
- name: Extract package info
id: package_info
if: success()
run: |
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
echo "name=$(node -p "require('./package.json').name")" >> $GITHUB_OUTPUT

# Install Deno for small-things
- name: Install Deno
if: success()
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

# Clone small-things repository
- name: Clone small-things
if: success()
uses: actions/checkout@v6
with:
repository: smallcase/small-things
ref: main
path: small-things

# Track release in small-things (Slack notification)
- name: Track release in small-things
if: success()
env:
VERSION: ${{ steps.package_info.outputs.version }}
PACKAGE_NAME: ${{ steps.package_info.outputs.name }}
RELEASE_TYPE: ${{ vars.RELEASE_TYPE || 'prod' }}
run: |
# Determine SDK name from package name
SDK_NAME="scgateway"
if [[ "$PACKAGE_NAME" == *"gateway"* ]] || [[ "$PACKAGE_NAME" == *"Gateway"* ]] || [[ "$PACKAGE_NAME" == *"SCG"* ]]; then
SDK_NAME="scgateway"
elif [[ "$PACKAGE_NAME" == *"loan"* ]] || [[ "$PACKAGE_NAME" == *"Loan"* ]]; then
SDK_NAME="scloans"
else
SDK_NAME="$PACKAGE_NAME"
fi

# Determine release type (defaults to prod, can be overridden via vars)
RELEASE_TYPE="${RELEASE_TYPE:-prod}"

# Call small-things to track release (Slack webhook)
if [ -n "$VERSION" ] && [ -n "$SDK_NAME" ]; then
echo "Tracking release: $SDK_NAME v$VERSION (type: $RELEASE_TYPE)"

if [ -d "small-things" ]; then
cd small-things

deno run --allow-all main.ts gw track-release \
--platform react-native \
--sdkName "$SDK_NAME" \
--version "$VERSION" \
--publishTarget "npm" \
--releaseType "$RELEASE_TYPE" \
2>&1 || {
echo "Warning: Failed to track release in small-things (non-critical - build continues)"
}
else
echo "Warning: small-things directory not found. Skipping release tracking (non-critical)."
fi
else
echo "Warning: Could not determine SDK name or version. Skipping release tracking."
fi
15 changes: 15 additions & 0 deletions ios/SmallcaseGateway.m
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,21 @@ @interface RCT_EXTERN_MODULE(SmallcaseGateway, NSObject)
resolve(responseDict);
return;
}

//MARK: intent - mf holdings import
if ([response isKindOfClass: [ObjCTransactionIntentMfHoldingsImport class]]) {
ObjCTransactionIntentMfHoldingsImport *trxResponse = response;
// Use existing responseDict (already has success: true from line 169)
[responseDict setValue:@"MF_HOLDINGS_IMPORT" forKey:@"transaction"];

if (trxResponse.data != nil && trxResponse.data.length > 0) {
[responseDict setObject:trxResponse.data forKey:@"data"];
} else {
[responseDict setObject:@"" forKey:@"data"];
}
resolve(responseDict);
return;
}

//MARK: intent - fetch funds
if([response isKindOfClass: [ObjcTransactionIntentFetchFunds class]]) {
Expand Down
2 changes: 1 addition & 1 deletion react-native-smallcase-gateway.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ Pod::Spec.new do |s|
s.dependency "ReactCommon/turbomodule/core"
end

s.dependency 'SCGateway', '7.1.0'
s.dependency 'SCGateway-dhruv-gw-track-release-2924646', '7.1.0-19-debug'
s.dependency 'SCLoans', '7.0.0'
end
27 changes: 14 additions & 13 deletions smart_investing_react_native/app/apis/Functions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,6 @@ async function connect(env: Environment, userId: string): Promise<Boolean> {
}
}

async function triggerMftxn(env: Environment, transactionId: string) {
try {
console.log(`Transaction ID: ${transactionId}, Intent: MF_HOLDINGS_IMPORT`);
console.log('triggerMftxn txn id: ' + transactionId);
const res = await SmallcaseGateway.triggerMfTransaction(transactionId);
console.log('triggerMftxn res: ' + JSON.stringify(res));
await alert('triggerMftxn', JSON.stringify(res));
} catch (error) {
console.log('triggerMftxn error - ' + error);
console.log('triggerMftxn error stringified - ' + JSON.stringify(error));
await alert('triggerMftxn Error', getErrorString(error));
}
}

async function placeSstOrder(
env: Environment,
Expand Down Expand Up @@ -527,6 +514,20 @@ async function triggerTxn(txnId: string) {
}
}

async function triggerMftxn(env: Environment, transactionId: string) {
try {
console.log(`Transaction ID: ${transactionId}, Intent: MF_HOLDINGS_IMPORT`);
console.log('triggertxn for MF txn id: ' + transactionId);
const res = await SmallcaseGateway.triggerTransaction(transactionId);
console.log('triggertxn for MF res: ' + JSON.stringify(res));
await alert('triggertxn for MF', JSON.stringify(res));
} catch (error) {
console.log('triggertxn for MF error - ' + error);
console.log('triggertxn for MF error stringified - ' + JSON.stringify(error));
await alert('triggertxn for MF Error', getErrorString(error));
}
}

const sleep = (ms: number) =>
new Promise(resolve => setTimeout((): void => resolve(undefined), ms));
const copyToClipboard = (value: string) => {
Expand Down
4 changes: 2 additions & 2 deletions smart_investing_react_native/app/screens/MFHoldingsScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useContext} from 'react';
import {TextInput} from 'react-native';
import {SmartButton} from './HoldingsScreen';
import {getTransactionId, triggerMftxn, alert} from '../apis/Functions';
import {getTransactionId, alert, triggerTxn} from '../apis/Functions';
import {EnvContext} from '../EnvProvider';
import {Environment} from '../apis/SmartInvestingService';
import {postbackSearch} from '../apis/SmartInvestingService';
Expand All @@ -27,7 +27,7 @@ async function getMfHoldings(env: Environment, txnId: string) {
alert('MF Holdings Postback Response', JSON.stringify(res));
}
async function importMFHoldings(env: Environment, txnId: string) {
await triggerMftxn(env, txnId);
await triggerTxn(txnId);
getMfHoldings(env, txnId);
}

Expand Down