﻿CREATE PROCEDURE [API_GetUserInfo]
	@AccountWalletAddress nchar(42)
AS
	--Account
	SELECT 
	AccountId,
	UserId, 
	Symbol,
    CurrentBalance,
    CurrentBonusBalance,
    TotalPending,
    CreateDate,
    LastModifyDate,
    LastModifyOrigin,
    LastModifyOperatorId,
	WalletAddress
	into #accounts
	FROM [Accounts] with (nolock)
	WHERE 
	[WalletAddress] = @AccountWalletAddress

	SELECT * FROM #accounts

	DECLARE @UserId BIGINT = NULL
	SET @UserId = (SELECT TOP (1) UserId FROM #accounts)

	IF @UserId IS NOT NULL
	BEGIN
		exec REG_GetUsers @UserId = @UserId
	END

	